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

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

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

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

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

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

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

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

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

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

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