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

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

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

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

m = A("m")
l = B("l")
f = C("f")
g = D("g")
n = A("n")
a = B("a")
i = B("i")
j = D("j")

m.u = f
m.x = a
m.w = g
m.s = l
l.q = m
l.y = f
f.x = m
f.z = j
g.y = f
g.t = m
n.u = f
n.x = l
n.w = j
n.s = i
a.q = n
a.y = f
i.q = n
i.y = f
j.y = f
j.t = m
assert a.q.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: B = None
        self.w: D = None
        self.s: B = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
f = C("f")
g = D("g")
n = A("n")
a = B("a")
i = B("i")
j = D("j")

m.u = f
m.x = a
m.w = g
m.s = l
l.q = m
l.y = f
f.x = m
f.z = j
g.y = f
g.t = m
n.u = f
n.x = l
n.w = j
n.s = i
a.q = n
a.y = f
i.q = n
i.y = f
j.y = f
j.t = m
assert a.q.s.q.txt == "n"