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

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

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

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

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

a.u = n
a.t = m
a.z = f
n.v = f
f.u = n
f.r = g
g.x = m
g.t = n
m.x = k
m.t = n
k.x = m
k.t = n
j.x = g
j.t = n
assert m.x.x.t.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

a.u = n
a.t = m
a.z = f
n.v = f
f.u = n
f.r = g
g.x = m
g.t = n
m.x = k
m.t = n
k.x = m
k.t = n
j.x = g
j.t = n
assert m.x.x.t.v.u.txt == "n"