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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.x: A = None
        self.txt = txt

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

k = A("k")
i = B("i")
m = C("m")
g = A("g")
a = B("a")
c = A("c")
e = B("e")
f = B("f")

k.o = m
k.q = m
i.t = k
i.z = c
i.x = g
m.t = g
m.x = i
g.o = m
g.q = m
a.t = g
a.z = g
a.x = g
c.o = m
c.q = m
e.t = k
e.z = k
e.x = g
f.t = g
f.z = g
f.x = g
assert i.t.o.t.q.t.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.x: A = None
        self.txt = txt

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

k = A("k")
i = B("i")
m = C("m")
g = A("g")
a = B("a")
c = A("c")
e = B("e")
f = B("f")

k.o = m
k.q = m
i.t = k
i.z = c
i.x = g
m.t = g
m.x = i
g.o = m
g.q = m
a.t = g
a.z = g
a.x = g
c.o = m
c.q = m
e.t = k
e.z = k
e.x = g
f.t = g
f.z = g
f.x = g
assert i.t.o.t.q.t.q.x.txt == "i"