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

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

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

n = A("n")
f = B("f")
k = C("k")
i = C("i")
d = A("d")
e = B("e")
b = C("b")

n.s = e
n.z = d
n.o = i
f.q = k
k.z = n
k.o = i
k.x = f
i.z = n
i.o = k
i.x = e
d.s = f
d.z = n
d.o = k
e.q = b
b.z = d
b.o = k
b.x = e
assert i.z.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.o: C = None
        self.txt = txt

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

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

n = A("n")
f = B("f")
k = C("k")
i = C("i")
d = A("d")
e = B("e")
b = C("b")

n.s = e
n.z = d
n.o = i
f.q = k
k.z = n
k.o = i
k.x = f
i.z = n
i.o = k
i.x = e
d.s = f
d.z = n
d.o = k
e.q = b
b.z = d
b.o = k
b.x = e
assert i.z.o.o.o.txt == "i"