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

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

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

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

n = A("n")
e = B("e")
b = C("b")
f = D("f")
g = A("g")
h = D("h")
d = D("d")
a = A("a")
m = A("m")

n.q = b
n.r = b
n.z = b
n.u = h
e.q = b
b.v = n
b.s = n
b.t = e
f.y = e
g.q = b
g.r = b
g.z = b
g.u = h
h.y = e
d.y = e
a.q = b
a.r = b
a.z = b
a.u = f
m.q = b
m.r = b
m.z = b
m.u = f
assert h.y.q.t.q.t.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.z: C = None
        self.u: D = None
        self.txt = txt

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

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

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

n = A("n")
e = B("e")
b = C("b")
f = D("f")
g = A("g")
h = D("h")
d = D("d")
a = A("a")
m = A("m")

n.q = b
n.r = b
n.z = b
n.u = h
e.q = b
b.v = n
b.s = n
b.t = e
f.y = e
g.q = b
g.r = b
g.z = b
g.u = h
h.y = e
d.y = e
a.q = b
a.r = b
a.z = b
a.u = f
m.q = b
m.r = b
m.z = b
m.u = f
assert h.y.q.t.q.t.q.t.txt == "e"