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

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

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

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

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

e.t = h
e.q = n
i.t = k
b.r = h
b.z = f
b.p = g
f.t = h
g.t = b
h.r = b
h.z = f
h.p = k
k.t = h
n.t = g
l.t = b
l.q = i
j.t = b
assert h.p.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: B = None
        self.txt = txt

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

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

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

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

e.t = h
e.q = n
i.t = k
b.r = h
b.z = f
b.p = g
f.t = h
g.t = b
h.r = b
h.z = f
h.p = k
k.t = h
n.t = g
l.t = b
l.q = i
j.t = b
assert h.p.t.p.t.txt == "h"