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

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

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

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

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

j.x = c
f.u = n
h.q = i
h.z = l
n.t = i
n.q = l
m.x = c
k.x = c
l.u = n
b.x = c
c.t = i
c.q = f
i.q = h
i.z = l
assert h.q.q.q.q.q.q.z.u.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

j.x = c
f.u = n
h.q = i
h.z = l
n.t = i
n.q = l
m.x = c
k.x = c
l.u = n
b.x = c
c.t = i
c.q = f
i.q = h
i.z = l
assert h.q.q.q.q.q.q.z.u.t.q.txt == "h"