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

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

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

k = A("k")
a = B("a")
n = C("n")
m = B("m")

k.p = a
k.s = m
k.u = n
a.t = m
a.r = m
a.o = n
n.z = k
n.p = k
n.w = k
m.t = a
m.r = a
m.o = n
assert a.o.p.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: B = None
        self.u: C = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
n = C("n")
m = B("m")

k.p = a
k.s = m
k.u = n
a.t = m
a.r = m
a.o = n
n.z = k
n.p = k
n.w = k
m.t = a
m.r = a
m.o = n
assert a.o.p.p.t.txt == "m"