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

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

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

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

n = A("n")
j = B("j")
c = C("c")
e = D("e")
m = A("m")
k = A("k")
a = B("a")
b = C("b")
d = D("d")

n.t = m
n.z = e
n.s = d
n.u = c
j.s = n
j.z = a
c.s = j
c.x = d
c.p = k
e.z = b
e.x = c
m.t = n
m.z = d
m.s = e
m.u = b
k.t = n
k.z = d
k.s = e
k.u = b
a.s = m
a.z = j
b.s = j
b.x = e
b.p = n
d.z = b
d.x = b
assert a.s.t.z.z.x.z.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: D = None
        self.s: D = None
        self.u: C = None
        self.txt = txt

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

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

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

n = A("n")
j = B("j")
c = C("c")
e = D("e")
m = A("m")
k = A("k")
a = B("a")
b = C("b")
d = D("d")

n.t = m
n.z = e
n.s = d
n.u = c
j.s = n
j.z = a
c.s = j
c.x = d
c.p = k
e.z = b
e.x = c
m.t = n
m.z = d
m.s = e
m.u = b
k.t = n
k.z = d
k.s = e
k.u = b
a.s = m
a.z = j
b.s = j
b.x = e
b.p = n
d.z = b
d.x = b
assert a.s.t.z.z.x.z.p.u.txt == "c"