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

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

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

m = A("m")
e = B("e")
a = C("a")
n = C("n")
k = C("k")
c = B("c")
g = A("g")

m.z = g
m.o = e
m.v = a
e.y = c
a.v = e
a.x = k
n.v = e
n.x = a
k.v = e
k.x = a
c.y = e
g.z = m
g.o = c
g.v = n
assert n.x.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: B = None
        self.v: C = None
        self.txt = txt

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

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

m = A("m")
e = B("e")
a = C("a")
n = C("n")
k = C("k")
c = B("c")
g = A("g")

m.z = g
m.o = e
m.v = a
e.y = c
a.v = e
a.x = k
n.v = e
n.x = a
k.v = e
k.x = a
c.y = e
g.z = m
g.o = c
g.v = n
assert n.x.v.y.y.txt == "e"