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

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

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

c = A("c")
i = B("i")
b = C("b")
e = A("e")
d = C("d")
g = A("g")
l = A("l")
h = A("h")
m = A("m")

c.v = i
c.p = i
i.p = e
i.o = b
b.q = g
b.z = l
e.v = i
e.p = i
d.q = l
d.z = c
g.v = i
g.p = i
l.v = i
l.p = i
h.v = i
h.p = i
m.v = i
m.p = i
assert i.o.q.v.p.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

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

c = A("c")
i = B("i")
b = C("b")
e = A("e")
d = C("d")
g = A("g")
l = A("l")
h = A("h")
m = A("m")

c.v = i
c.p = i
i.p = e
i.o = b
b.q = g
b.z = l
e.v = i
e.p = i
d.q = l
d.z = c
g.v = i
g.p = i
l.v = i
l.p = i
h.v = i
h.p = i
m.v = i
m.p = i
assert i.o.q.v.p.v.p.txt == "e"