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

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

e = A("e")
n = B("n")
i = A("i")
m = B("m")
b = A("b")
l = B("l")
c = B("c")
a = B("a")
f = A("f")
h = A("h")

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

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

e = A("e")
n = B("n")
i = A("i")
m = B("m")
b = A("b")
l = B("l")
c = B("c")
a = B("a")
f = A("f")
h = A("h")

e.p = m
e.t = l
n.q = e
i.p = n
i.t = c
m.q = f
b.p = c
b.t = n
l.q = f
c.q = i
a.q = h
f.p = n
f.t = n
h.p = m
h.t = l
assert c.q.p.q.p.q.p.q.p.q.t.txt == "n"