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

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

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

h = A("h")
j = B("j")
e = C("e")
l = B("l")

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

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

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

h = A("h")
j = B("j")
e = C("e")
l = B("l")

h.z = e
h.o = e
h.r = l
j.r = e
e.u = j
e.p = j
e.z = h
l.r = e
assert h.r.r.z.o.txt == "e"