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

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

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

n = A("n")
f = B("f")
a = C("a")
i = A("i")
l = B("l")

n.y = a
n.o = f
f.z = i
f.t = i
f.s = n
a.s = i
a.q = f
i.y = a
i.o = l
l.z = i
l.s = i
l.t = n
assert i.y.q.z.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: B = None
        self.txt = txt

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

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

n = A("n")
f = B("f")
a = C("a")
i = A("i")
l = B("l")

n.y = a
n.o = f
f.z = i
f.t = i
f.s = n
a.s = i
a.q = f
i.y = a
i.o = l
l.z = i
l.s = i
l.t = n
assert i.y.q.z.y.s.txt == "i"