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

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

e = A("e")
n = B("n")
m = B("m")
k = B("k")
a = A("a")
j = B("j")

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

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

e = A("e")
n = B("n")
m = B("m")
k = B("k")
a = A("a")
j = B("j")

e.t = n
e.y = n
n.t = m
n.p = j
m.t = j
m.p = n
k.t = n
k.p = n
a.t = j
a.y = m
j.t = n
j.p = n
assert a.y.p.t.p.t.p.txt == "n"