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

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

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

d = A("d")
g = B("g")
i = C("i")
a = A("a")
k = B("k")
e = A("e")
n = C("n")

d.s = n
d.o = n
d.w = g
g.u = a
g.v = k
i.z = k
a.s = i
a.w = k
a.o = n
k.u = e
k.v = g
e.s = i
e.w = g
e.o = n
n.z = g
assert i.z.u.o.z.u.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: B = None
        self.o: C = None
        self.txt = txt

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

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

d = A("d")
g = B("g")
i = C("i")
a = A("a")
k = B("k")
e = A("e")
n = C("n")

d.s = n
d.o = n
d.w = g
g.u = a
g.v = k
i.z = k
a.s = i
a.w = k
a.o = n
k.u = e
k.v = g
e.s = i
e.w = g
e.o = n
n.z = g
assert i.z.u.o.z.u.o.z.txt == "g"