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

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

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

d = A("d")
l = B("l")
a = C("a")
m = A("m")
n = C("n")

d.r = l
d.v = l
d.y = m
l.t = d
l.q = n
l.v = m
a.u = l
a.z = n
a.s = m
m.r = l
m.v = l
m.y = d
n.u = l
n.z = a
n.s = d
assert a.s.r.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: A = None
        self.v: B = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
a = C("a")
m = A("m")
n = C("n")

d.r = l
d.v = l
d.y = m
l.t = d
l.q = n
l.v = m
a.u = l
a.z = n
a.s = m
m.r = l
m.v = l
m.y = d
n.u = l
n.z = a
n.s = d
assert a.s.r.t.y.txt == "m"