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

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

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

d = A("d")
b = B("b")
k = C("k")
f = A("f")
e = C("e")
j = A("j")
m = C("m")
g = C("g")
h = C("h")
i = C("i")

d.o = h
d.t = e
d.u = b
b.p = e
k.z = h
f.o = h
f.t = k
f.u = b
e.z = i
j.o = e
j.t = i
j.u = b
m.z = k
g.z = i
h.z = g
i.z = m
assert j.t.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: C = None
        self.u: B = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
k = C("k")
f = A("f")
e = C("e")
j = A("j")
m = C("m")
g = C("g")
h = C("h")
i = C("i")

d.o = h
d.t = e
d.u = b
b.p = e
k.z = h
f.o = h
f.t = k
f.u = b
e.z = i
j.o = e
j.t = i
j.u = b
m.z = k
g.z = i
h.z = g
i.z = m
assert j.t.z.z.z.txt == "h"