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

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

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

e = A("e")
l = B("l")
g = C("g")
k = C("k")

e.x = l
e.v = k
l.q = e
l.p = e
l.r = g
g.u = k
k.u = g
assert g.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

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

e = A("e")
l = B("l")
g = C("g")
k = C("k")

e.x = l
e.v = k
l.q = e
l.p = e
l.r = g
g.u = k
k.u = g
assert g.u.u.u.u.txt == "g"