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

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

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

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

l = A("l")
j = B("j")
a = C("a")
d = D("d")
e = B("e")
k = C("k")
b = A("b")
i = A("i")
f = A("f")
h = C("h")

l.z = d
l.u = b
l.p = e
j.q = d
a.q = j
d.t = h
d.o = k
e.q = d
k.q = e
b.z = d
b.u = l
b.p = j
i.z = d
i.u = f
i.p = j
f.z = d
f.u = i
f.p = j
h.q = j
assert h.q.q.o.q.q.t.q.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: A = None
        self.p: B = None
        self.txt = txt

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

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

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

l = A("l")
j = B("j")
a = C("a")
d = D("d")
e = B("e")
k = C("k")
b = A("b")
i = A("i")
f = A("f")
h = C("h")

l.z = d
l.u = b
l.p = e
j.q = d
a.q = j
d.t = h
d.o = k
e.q = d
k.q = e
b.z = d
b.u = l
b.p = j
i.z = d
i.u = f
i.p = j
f.z = d
f.u = i
f.p = j
h.q = j
assert h.q.q.o.q.q.t.q.q.o.txt == "k"