#orignal list
list_one = [['a','b'],['a','c'],['b','c'],['b','a']]
li=[]
for i in list_one:
    for j in list_one:
        if i[0] == j[1] and j[0] == i[1]:
            li.append([i,j])
print(li)
#[[['a', 'b'], ['b', 'a']], [['b', 'a'], ['a', 'b']]]
I need the output to be [a,b] only the a and b can vary depending on the condition like a can be apple or anything
 
     
     
     
    