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

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

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

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

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

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

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

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

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