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

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

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

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

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

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

l.z = k
n.t = j
n.y = j
f.t = l
f.y = k
d.z = l
h.t = d
h.y = k
j.z = k
c.t = l
c.y = j
i.t = l
i.y = k
k.z = d
assert i.t.z.z.z.txt == "l"