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

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

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

c = A("c")
h = B("h")
e = C("e")
b = C("b")

c.p = e
c.o = h
h.u = e
e.s = b
e.z = b
e.u = h
b.s = e
b.z = e
b.u = h
assert b.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
e = C("e")
b = C("b")

c.p = e
c.o = h
h.u = e
e.s = b
e.z = b
e.u = h
b.s = e
b.z = e
b.u = h
assert b.u.u.u.txt == "h"