This kata provides you with a list of parent-child pairs `family_list`, and from this family description you'll need to find the relationship between two members(what is the relation of latter with former) which is given as `target_pair`.
For example, the family list may be given as:
`[('Enid', 'Susan'), ('Susan', 'Deborah'), ('Enid', 'Dianne')]`
This describes the family:
          Enid
            |
       |---------|
     Susan     Dianne
       |
    Deborah
The relationship pair `('Deborah', 'Enid')` should return 'Grandmother' as Enid is Deborah's Grandmother.
This family tree can cover up to 3 generations, with varying numbers of children for each parent. We only focus on the females in the family, and so children will have only one parent.
The possible responses are Mother, Daughter, Grandmother, Granddaughter, Sister, Cousin, Aunt, Niece (each matching their 'real life' equivalents). There will always be a valid answer.
Enjoy, and be nice to your Mother!
def relations(family_list, target_pair):
    people=set(); gen1=[]; gen2=[]
    
    for i in family_list:
        people.add(i[0]); people.add(i[1])
    for i in people:
        if all(j[1]!=i for j in family_list):
            gen1.append(i)
    for i in family_list:
        if i[0] in gen1:
            gen2.append(i[1])
    gen3=[[] for i in range(len(gen2))]
    for i in family_list:
        if i[0] in gen2:
            gen3[gen2.index(i[0])].append(i[1])
    g3=sum(gen3,[])
    
    a,b = target_pair
    if a in gen1 and b in gen2: return 'Daughter'
    if a in gen2 and b in gen1: return 'Mother'
    if a in gen1 and b in g3: return 'Granddaughter'
    if a in g3 and b in gen1: return 'Grandmother'
    
    if a in gen2 and b in gen2: return 'Sister'
    for i in gen3:
        if a in i and b in i: return 'Sister'
    if a in g3 and b in g3: return 'Cousin'
    if a in gen2 and b in gen3[gen2.index(a)]: return 'Daughter'
    if b in gen2 and a in gen3[gen2.index(b)]: return 'Mother'
    if a in gen2: return 'Niece'
    return 'Aunt'
    

def relations(family_list, target_pair):
    people=set(); gen1=[]; gen2=[]
    
    for i in family_list:
        people.add(i[0]); people.add(i[1])
    for i in people:
        if all(j[1]!=i for j in family_list):
            gen1.append(i)
    for i in family_list:
        if i[0] in gen1:
            gen2.append(i[1])
    gen3=[[] for i in range(len(gen2))]
    for i in family_list:
        if i[0] in gen2:
            gen3[gen2.index(i[0])].append(i[1])
    g3=sum(gen3,[])
    
    a,b = target_pair
    if a in gen1 and b in gen2: return 'Daughter'
    if a in gen2 and b in gen1: return 'Mother'
    if a in gen1 and b in g3: return 'Granddaughter'
    if a in g3 and b in gen1: return 'Grandmother'
    
    if a in gen2 and b in gen2: return 'Sister'
    for i in gen3:
        if a in i and b in i: return 'Sister'
    if a in g3 and b in g3: return 'Cousin'
    if a in gen2 and b in gen3[gen2.index(a)]: return 'Daughter'
    if b in gen2 and a in gen3[gen2.index(b)]: return 'Mother'
    if a in gen2: return 'Niece'
    return 'Aunt'
    
