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

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

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

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

f.s = n
n.o = i
i.p = f
i.x = a
a.o = i
assert i.x.o.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

f.s = n
n.o = i
i.p = f
i.x = a
a.o = i
assert i.x.o.p.s.txt == "n"