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.s: A = None
        self.txt = txt

b = A("b")
n = B("n")
h = A("h")
a = A("a")
f = A("f")
l = A("l")
m = B("m")
c = A("c")
k = B("k")
g = A("g")

b.p = m
b.t = k
n.s = h
h.p = n
h.t = m
a.p = m
a.t = m
f.p = k
f.t = m
l.p = k
l.t = n
m.s = l
c.p = m
c.t = m
k.s = g
g.p = m
g.t = m
assert c.t.s.t.s.p.s.t.s.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.s: A = None
        self.txt = txt

b = A("b")
n = B("n")
h = A("h")
a = A("a")
f = A("f")
l = A("l")
m = B("m")
c = A("c")
k = B("k")
g = A("g")

b.p = m
b.t = k
n.s = h
h.p = n
h.t = m
a.p = m
a.t = m
f.p = k
f.t = m
l.p = k
l.t = n
m.s = l
c.p = m
c.t = m
k.s = g
g.p = m
g.t = m
assert c.t.s.t.s.p.s.t.s.t.txt == "n"