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

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

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

e = A("e")
a = B("a")
f = C("f")
d = C("d")
j = B("j")

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

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

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

e = A("e")
a = B("a")
f = C("f")
d = C("d")
j = B("j")

e.p = a
a.q = d
a.r = d
a.u = f
f.t = e
f.r = e
f.u = d
d.t = e
d.r = e
d.u = f
j.q = d
j.u = d
j.r = d
assert a.u.u.t.txt == "e"