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

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

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

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

d.z = n
d.x = l
k.y = b
k.v = a
k.u = l
a.z = d
n.z = d
n.x = l
b.z = d
l.y = b
l.v = b
l.u = k
assert n.z.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: B = None
        self.txt = txt

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

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

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

d.z = n
d.x = l
k.y = b
k.v = a
k.u = l
a.z = d
n.z = d
n.x = l
b.z = d
l.y = b
l.v = b
l.u = k
assert n.z.z.x.txt == "l"