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

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

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

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

d.x = i
d.o = e
d.z = e
b.t = e
n.z = j
n.u = f
n.r = f
f.z = b
f.u = n
f.r = h
h.z = j
h.u = i
h.r = i
i.z = j
i.u = n
i.r = f
a.x = f
a.o = e
a.z = j
c.x = n
c.o = e
c.z = j
e.t = b
j.t = e
assert f.r.r.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: B = None
        self.z: B = None
        self.txt = txt

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

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

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

d.x = i
d.o = e
d.z = e
b.t = e
n.z = j
n.u = f
n.r = f
f.z = b
f.u = n
f.r = h
h.z = j
h.u = i
h.r = i
i.z = j
i.u = n
i.r = f
a.x = f
a.o = e
a.z = j
c.x = n
c.o = e
c.z = j
e.t = b
j.t = e
assert f.r.r.u.z.txt == "j"