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

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

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

d = A("d")
e = B("e")
c = C("c")
j = C("j")
l = A("l")
f = C("f")
a = B("a")
n = B("n")
i = C("i")

d.z = c
e.w = l
c.u = l
c.x = j
c.z = a
j.u = l
j.x = i
j.z = a
l.z = i
f.u = l
f.x = i
f.z = a
a.w = d
n.w = d
i.u = d
i.x = c
i.z = e
assert i.u.z.u.z.x.x.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

d = A("d")
e = B("e")
c = C("c")
j = C("j")
l = A("l")
f = C("f")
a = B("a")
n = B("n")
i = C("i")

d.z = c
e.w = l
c.u = l
c.x = j
c.z = a
j.u = l
j.x = i
j.z = a
l.z = i
f.u = l
f.x = i
f.z = a
a.w = d
n.w = d
i.u = d
i.x = c
i.z = e
assert i.u.z.u.z.x.x.u.z.txt == "i"