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

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

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

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

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

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

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

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

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