Need urgent help in comparing two fields in two files

Hi all,

I have two files as below. I need to compare field 2 of file 1 against field 1 of file 2 and field 5 of file 1 against filed 2 of file 2. If both matches , then create a result file 1 with first file data and if not matches , then create file with first fie data. Please help me in achieving this.

 awk 'NR=FNR{a[$1]=$0;next} { split ( a[$1],x, " ") if ( ( $2 ~ x[1] ) and ( $5 ~ x[2] ) ) { print $0 > "yes.txt"; } else { print $0 > " no.txt" } ; }' file2 file1 2>> log.txt  

File1 :

1234 chennai kovai 1256 ooty
2331 Madras Coimbatore 3234 Bangalore
5467 Chennai city 2456 oo

File 2:

Madras blr 
Chennai ooty

Result file 1 :- yes.txt

1234 chennai kovai 1256 ooty

Result file 2:- no.txt

2331 Madras Coimbatore  3234 Bangalore 
5467 Chennai city 2456 oo

Looks like duplicate post http://www.unix.com/unix-for-advanced-and-expert-users/252318-need-help-comparing-multiple-columns-two-files.html\#post302922185