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

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

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

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

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

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

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

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

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