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

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

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

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

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

m.z = i
l.x = e
l.p = e
e.u = j
i.u = m
i.y = e
f.x = e
f.p = e
j.u = e
b.u = m
b.y = j
g.u = m
g.y = j
a.x = j
a.p = e
n.u = m
n.y = j
assert n.y.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

m.z = i
l.x = e
l.p = e
e.u = j
i.u = m
i.y = e
f.x = e
f.p = e
j.u = e
b.u = m
b.y = j
g.u = m
g.y = j
a.x = j
a.p = e
n.u = m
n.y = j
assert n.y.u.u.u.u.txt == "j"