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

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

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

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

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

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

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

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

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