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

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

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

f = A("f")
a = B("a")
c = C("c")
j = A("j")
d = B("d")
b = A("b")
k = C("k")

f.x = c
a.t = j
a.z = j
c.v = b
c.r = k
c.z = k
j.x = c
d.t = f
d.z = f
b.x = c
k.v = b
k.r = c
k.z = c
assert c.v.x.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

f = A("f")
a = B("a")
c = C("c")
j = A("j")
d = B("d")
b = A("b")
k = C("k")

f.x = c
a.t = j
a.z = j
c.v = b
c.r = k
c.z = k
j.x = c
d.t = f
d.z = f
b.x = c
k.v = b
k.r = c
k.z = c
assert c.v.x.v.x.txt == "c"