Compare two lists

Hi all.
I have two files like this:

q: lines of file "c:\tmp\1.txt"
A: sergiocasado
A: anaruiz
A: danielvarela
A: pepesaez
T: 0.383 ms
I: plural file line

q: lines of file "c:\tmp\2.txt"
A: saez
A: varela
A: casado
T: 0.510 ms
I: plural file line

You can see the items 0 and 1 of the files like this:

q: (item 0 of it, item 1 of it) of (lines of file "c:\tmp\1.txt", lines of file "c:\tmp\2.txt")
A: sergiocasado, saez
A: sergiocasado, varela
A: sergiocasado, casado
A: anaruiz, saez
A: anaruiz, varela
A: anaruiz, casado
A: danielvarela, saez
A: danielvarela, varela
A: danielvarela, casado
A: pepesaez, saez
A: pepesaez, varela
A: pepesaez, casado
T: 1.552 ms
I: plural ( file line, file line )

Now i need only the item 0 thats ends with item 1.
How can i do?
I am trying some relevances with intersections, set, etc but don´t works (because don´t be the correct format of relevance)
I´m trying too:

q: (item 0 of it whose (item 0 of it as string ends with item 1 of it as string)) of (lines of file "c:\tmp\1.txt", lines of file "c:\tmp\2.txt")
E: Singular expression refers to nonexistent object.

I got it:

 q: (item 0 of it) of (lines of file "c:\tmp\1.txt", lines of file "c:\tmp\2.txt") whose (item 0 of it as string ends with item 1 of it as string)
    A: sergiocasado
    A: danielvarela
    A: pepesaez
    T: 1.459 ms
    I: plural file line
1 Like