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

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

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

k = A("k")
j = B("j")
a = C("a")
g = A("g")
d = A("d")
m = B("m")
b = C("b")
l = B("l")
f = A("f")

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

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

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

k = A("k")
j = B("j")
a = C("a")
g = A("g")
d = A("d")
m = B("m")
b = C("b")
l = B("l")
f = A("f")

k.z = b
k.t = m
j.t = a
j.o = l
a.t = b
a.w = k
a.p = m
g.z = a
g.t = m
d.z = b
d.t = m
m.t = a
m.o = j
b.t = a
b.w = k
b.p = m
l.t = b
l.o = j
f.z = a
f.t = m
assert a.p.t.w.z.t.p.txt == "m"