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

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

l = A("l")
a = B("a")
i = A("i")
k = B("k")
m = B("m")
d = B("d")
e = B("e")
n = B("n")
h = B("h")
c = A("c")

l.t = m
l.q = a
a.p = c
a.x = l
i.t = m
i.q = k
k.p = l
k.x = i
m.p = i
m.x = l
d.p = i
d.x = i
e.p = i
e.x = l
n.p = i
n.x = i
h.p = l
h.x = l
c.t = n
c.q = h
assert e.x.q.x.q.x.q.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.q: B = None
        self.txt = txt

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

l = A("l")
a = B("a")
i = A("i")
k = B("k")
m = B("m")
d = B("d")
e = B("e")
n = B("n")
h = B("h")
c = A("c")

l.t = m
l.q = a
a.p = c
a.x = l
i.t = m
i.q = k
k.p = l
k.x = i
m.p = i
m.x = l
d.p = i
d.x = i
e.p = i
e.x = l
n.p = i
n.x = i
h.p = l
h.x = l
c.t = n
c.q = h
assert e.x.q.x.q.x.q.p.t.txt == "n"