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

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

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

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

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

n.p = b
n.q = d
n.t = a
h.o = e
h.p = b
h.u = d
e.q = d
e.o = n
e.v = k
d.u = e
d.s = n
d.p = b
k.u = e
k.p = e
k.s = n
b.q = d
b.o = n
b.v = k
a.o = e
a.p = b
a.u = d
assert n.p.v.u.v.p.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: D = None
        self.t: B = None
        self.txt = txt

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

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

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

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

n.p = b
n.q = d
n.t = a
h.o = e
h.p = b
h.u = d
e.q = d
e.o = n
e.v = k
d.u = e
d.s = n
d.p = b
k.u = e
k.p = e
k.s = n
b.q = d
b.o = n
b.v = k
a.o = e
a.p = b
a.u = d
assert n.p.v.u.v.p.o.t.txt == "a"