class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

i = A("i")
l = B("l")
k = C("k")
c = A("c")
h = B("h")
d = C("d")
n = C("n")
j = C("j")

i.u = h
i.y = c
l.s = h
k.z = l
c.u = h
c.y = i
h.s = l
d.z = h
n.z = h
j.z = l
assert i.y.y.u.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

i = A("i")
l = B("l")
k = C("k")
c = A("c")
h = B("h")
d = C("d")
n = C("n")
j = C("j")

i.u = h
i.y = c
l.s = h
k.z = l
c.u = h
c.y = i
h.s = l
d.z = h
n.z = h
j.z = l
assert i.y.y.u.s.s.s.s.txt == "h"