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

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

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

a = A("a")
n = B("n")
j = C("j")
i = A("i")
k = C("k")
f = B("f")
m = B("m")

a.o = k
a.x = n
n.y = f
n.q = k
j.t = i
j.u = k
i.o = j
i.x = f
k.t = a
k.u = j
f.y = n
f.q = k
m.y = f
m.q = j
assert i.o.u.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: B = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
j = C("j")
i = A("i")
k = C("k")
f = B("f")
m = B("m")

a.o = k
a.x = n
n.y = f
n.q = k
j.t = i
j.u = k
i.o = j
i.x = f
k.t = a
k.u = j
f.y = n
f.q = k
m.y = f
m.q = j
assert i.o.u.u.t.txt == "i"