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

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

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

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

c = A("c")
a = B("a")
d = C("d")
e = D("e")
m = A("m")
l = B("l")

c.r = e
c.t = a
a.w = d
a.x = m
d.z = c
d.q = c
d.o = l
e.v = l
m.r = e
m.t = a
l.w = d
l.x = m
assert l.x.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: B = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
d = C("d")
e = D("e")
m = A("m")
l = B("l")

c.r = e
c.t = a
a.w = d
a.x = m
d.z = c
d.q = c
d.o = l
e.v = l
m.r = e
m.t = a
l.w = d
l.x = m
assert l.x.r.v.txt == "l"