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

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

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

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

n = A("n")
h = B("h")
i = C("i")
e = D("e")
a = D("a")
d = B("d")
l = B("l")
b = C("b")

n.q = d
h.v = d
h.z = a
h.x = l
h.t = n
i.w = l
i.q = h
e.p = n
e.y = a
e.x = a
a.p = n
a.y = e
a.x = e
d.v = h
d.z = e
d.x = l
d.t = n
l.v = h
l.z = e
l.x = d
l.t = n
b.w = l
b.q = d
assert h.z.p.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

n = A("n")
h = B("h")
i = C("i")
e = D("e")
a = D("a")
d = B("d")
l = B("l")
b = C("b")

n.q = d
h.v = d
h.z = a
h.x = l
h.t = n
i.w = l
i.q = h
e.p = n
e.y = a
e.x = a
a.p = n
a.y = e
a.x = e
d.v = h
d.z = e
d.x = l
d.t = n
l.v = h
l.z = e
l.x = d
l.t = n
b.w = l
b.q = d
assert h.z.p.q.t.txt == "n"