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

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

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

i = A("i")
j = B("j")
g = C("g")
k = A("k")
n = C("n")
d = A("d")
m = B("m")
b = C("b")

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

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

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

i = A("i")
j = B("j")
g = C("g")
k = A("k")
n = C("n")
d = A("d")
m = B("m")
b = C("b")

i.o = j
i.r = n
i.u = n
j.z = d
j.p = n
g.t = j
k.o = m
k.r = n
k.u = n
n.t = j
d.o = j
d.r = b
d.u = n
m.z = i
m.p = b
b.t = j
assert k.o.p.t.txt == "j"