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

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

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

l = A("l")
c = B("c")
i = C("i")
m = B("m")
d = A("d")
e = A("e")
a = B("a")
n = C("n")

l.p = n
c.t = n
c.p = i
c.s = m
i.s = n
m.t = n
m.p = n
m.s = a
d.p = n
e.p = n
a.t = n
a.p = i
a.s = c
n.s = i
assert c.t.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

l = A("l")
c = B("c")
i = C("i")
m = B("m")
d = A("d")
e = A("e")
a = B("a")
n = C("n")

l.p = n
c.t = n
c.p = i
c.s = m
i.s = n
m.t = n
m.p = n
m.s = a
d.p = n
e.p = n
a.t = n
a.p = i
a.s = c
n.s = i
assert c.t.s.s.s.txt == "i"