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

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

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

d = A("d")
l = B("l")
c = C("c")
b = A("b")
n = A("n")
k = C("k")

d.z = k
d.y = l
l.v = c
c.s = l
c.z = l
c.t = d
b.z = c
b.y = l
n.z = c
n.y = l
k.s = l
k.z = l
k.t = b
assert c.t.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: B = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
c = C("c")
b = A("b")
n = A("n")
k = C("k")

d.z = k
d.y = l
l.v = c
c.s = l
c.z = l
c.t = d
b.z = c
b.y = l
n.z = c
n.y = l
k.s = l
k.z = l
k.t = b
assert c.t.y.v.txt == "c"