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

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

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

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

b = A("b")
m = B("m")
k = C("k")
g = D("g")
l = A("l")
d = D("d")

b.q = g
b.z = l
b.v = m
b.u = m
m.s = d
k.r = d
k.z = l
g.u = d
l.q = d
l.z = b
l.v = m
l.u = m
d.u = g
assert m.s.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: A = None
        self.v: B = None
        self.u: B = None
        self.txt = txt

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

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

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

b = A("b")
m = B("m")
k = C("k")
g = D("g")
l = A("l")
d = D("d")

b.q = g
b.z = l
b.v = m
b.u = m
m.s = d
k.r = d
k.z = l
g.u = d
l.q = d
l.z = b
l.v = m
l.u = m
d.u = g
assert m.s.u.u.u.u.u.txt == "g"