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

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

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

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

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

n.v = h
l.w = d
l.q = d
l.o = n
l.t = k
a.s = l
a.v = i
a.q = d
i.p = n
d.s = k
d.v = i
d.q = a
j.s = k
j.v = h
j.q = d
h.p = n
k.w = a
k.q = d
k.o = n
k.t = l
e.p = n
assert a.s.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

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

n.v = h
l.w = d
l.q = d
l.o = n
l.t = k
a.s = l
a.v = i
a.q = d
i.p = n
d.s = k
d.v = i
d.q = a
j.s = k
j.v = h
j.q = d
h.p = n
k.w = a
k.q = d
k.o = n
k.t = l
e.p = n
assert a.s.t.q.txt == "d"