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

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

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

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

n = A("n")
h = B("h")
k = C("k")
j = D("j")
b = A("b")
f = D("f")
e = C("e")
m = D("m")
c = D("c")

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

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

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

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

n = A("n")
h = B("h")
k = C("k")
j = D("j")
b = A("b")
f = D("f")
e = C("e")
m = D("m")
c = D("c")

n.u = c
n.x = j
n.t = k
h.v = n
h.p = k
h.q = b
k.w = e
k.s = f
k.z = f
k.u = c
j.v = k
b.u = j
b.x = c
b.t = k
f.v = e
e.w = k
e.s = j
e.z = m
e.u = m
m.v = e
c.v = e
assert e.s.v.w.u.v.z.v.txt == "e"