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

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

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

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

m.r = e
m.t = e
m.u = e
a.r = e
b.t = c
b.p = i
i.t = c
i.p = c
e.r = m
e.t = m
e.u = m
c.t = i
c.p = i
n.t = c
n.p = i
j.r = m
k.r = e
assert b.t.t.t.t.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: A = None
        self.u: A = None
        self.txt = txt

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

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

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

m.r = e
m.t = e
m.u = e
a.r = e
b.t = c
b.p = i
i.t = c
i.p = c
e.r = m
e.t = m
e.u = m
c.t = i
c.p = i
n.t = c
n.p = i
j.r = m
k.r = e
assert b.t.t.t.t.p.p.p.txt == "c"