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

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

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

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

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

n.p = h
n.q = d
n.y = m
a.t = m
i.x = m
h.v = m
h.x = l
h.t = e
h.q = g
d.x = l
e.p = g
e.q = d
e.y = m
g.v = m
g.x = m
g.t = n
g.q = h
f.p = g
f.q = d
f.y = l
m.t = l
l.t = m
assert h.t.p.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

n.p = h
n.q = d
n.y = m
a.t = m
i.x = m
h.v = m
h.x = l
h.t = e
h.q = g
d.x = l
e.p = g
e.q = d
e.y = m
g.v = m
g.x = m
g.t = n
g.q = h
f.p = g
f.q = d
f.y = l
m.t = l
l.t = m
assert h.t.p.t.p.t.txt == "e"