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

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: C = None
        self.txt = txt

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

m.o = e
k.t = m
a.s = n
a.p = j
n.s = j
n.p = j
e.t = m
b.t = m
j.s = n
j.p = a
h.t = m
assert b.t.o.t.o.txt == "e"