Hello Anu,
Try
=IF(AND(NOT(ISNA(VLOOKUP(A2,Sheet2!A:A,1,FALSE))),NOT(ISNA(VLOOKUP(B2,Sheet2!B:B,1,FALSE)))),"yes","no")
Please be aware that the values do not have to be on the same line on Sheet2 to get a positive result. If they have to be on the same line that is another thing altogether.
For this case try
=IF(SUMPRODUCT((Sheet2!A:A=Sheet1!A2)*(Sheet2!B:B=Sheet1!B2)),"YES","NO")
Regards
Harry