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

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

l = A("l")
n = B("n")
k = B("k")
e = B("e")
a = B("a")
h = A("h")
d = B("d")
j = A("j")
f = A("f")
b = B("b")

l.t = d
n.p = h
n.y = e
k.p = h
k.y = n
e.p = l
e.y = a
a.p = f
a.y = b
h.t = e
d.p = f
d.y = k
j.t = a
f.t = a
b.p = l
b.y = a
assert j.t.p.t.p.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

l = A("l")
n = B("n")
k = B("k")
e = B("e")
a = B("a")
h = A("h")
d = B("d")
j = A("j")
f = A("f")
b = B("b")

l.t = d
n.p = h
n.y = e
k.p = h
k.y = n
e.p = l
e.y = a
a.p = f
a.y = b
h.t = e
d.p = f
d.y = k
j.t = a
f.t = a
b.p = l
b.y = a
assert j.t.p.t.p.t.p.t.txt == "a"