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

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

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

i = A("i")
a = B("a")
j = C("j")
e = A("e")
g = C("g")
f = B("f")

i.p = f
i.r = f
a.z = f
a.t = f
a.u = e
j.p = f
e.p = a
e.r = a
g.p = a
f.z = a
f.t = a
f.u = e
assert i.p.z.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: B = None
        self.txt = txt

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

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

i = A("i")
a = B("a")
j = C("j")
e = A("e")
g = C("g")
f = B("f")

i.p = f
i.r = f
a.z = f
a.t = f
a.u = e
j.p = f
e.p = a
e.r = a
g.p = a
f.z = a
f.t = a
f.u = e
assert i.p.z.t.t.t.txt == "f"