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

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

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

i = A("i")
g = B("g")
b = C("b")
e = C("e")
a = A("a")
c = A("c")

i.x = g
g.w = a
b.s = e
b.z = e
b.v = e
e.s = b
e.z = b
e.v = b
a.x = g
c.x = g
assert e.z.s.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

i = A("i")
g = B("g")
b = C("b")
e = C("e")
a = A("a")
c = A("c")

i.x = g
g.w = a
b.s = e
b.z = e
b.v = e
e.s = b
e.z = b
e.v = b
a.x = g
c.x = g
assert e.z.s.z.z.txt == "e"