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

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

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

g = A("g")
e = B("e")
d = C("d")
a = B("a")
c = C("c")
k = A("k")

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

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

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

g = A("g")
e = B("e")
d = C("d")
a = B("a")
c = C("c")
k = A("k")

g.z = a
e.w = d
e.v = a
d.x = c
d.t = a
a.w = c
a.v = e
c.x = d
c.t = e
k.z = a
assert c.t.v.v.txt == "e"