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

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

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

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

c.y = d
c.o = j
g.s = a
g.z = i
g.q = e
h.v = a
h.o = a
e.s = h
e.z = g
e.q = g
i.s = h
i.z = e
i.q = g
a.v = h
a.o = h
d.y = l
d.o = j
l.y = d
l.o = h
j.v = a
j.o = h
assert c.o.o.v.o.v.o.o.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: C = None
        self.txt = txt

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

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

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

c.y = d
c.o = j
g.s = a
g.z = i
g.q = e
h.v = a
h.o = a
e.s = h
e.z = g
e.q = g
i.s = h
i.z = e
i.q = g
a.v = h
a.o = h
d.y = l
d.o = j
l.y = d
l.o = h
j.v = a
j.o = h
assert c.o.o.v.o.v.o.o.o.v.txt == "a"