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

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

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

j = A("j")
g = B("g")
i = C("i")
h = B("h")
k = B("k")
b = B("b")
a = B("a")
e = A("e")
n = C("n")
m = B("m")

j.y = i
j.q = e
g.o = a
g.q = e
i.o = k
h.o = g
h.q = e
k.o = h
k.q = j
b.o = a
b.q = e
a.o = b
a.q = j
e.y = i
e.q = j
n.o = b
m.o = h
m.q = j
assert i.o.q.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: A = None
        self.txt = txt

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

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

j = A("j")
g = B("g")
i = C("i")
h = B("h")
k = B("k")
b = B("b")
a = B("a")
e = A("e")
n = C("n")
m = B("m")

j.y = i
j.q = e
g.o = a
g.q = e
i.o = k
h.o = g
h.q = e
k.o = h
k.q = j
b.o = a
b.q = e
a.o = b
a.q = j
e.y = i
e.q = j
n.o = b
m.o = h
m.q = j
assert i.o.q.y.o.txt == "k"