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

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

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

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

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

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

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

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

k.r = c
k.s = g
k.o = e
l.z = a
l.o = a
l.v = i
c.x = g
c.r = a
g.r = d
g.s = i
g.o = e
e.z = d
e.o = c
e.v = i
a.x = g
a.r = c
d.x = k
d.r = c
i.r = a
i.s = k
i.o = e
assert g.o.v.r.r.x.txt == "g"