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

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

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

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

l.r = i
l.w = i
l.o = f
f.s = i
f.z = i
i.z = f
assert f.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: C = None
        self.o: B = None
        self.txt = txt

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

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

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

l.r = i
l.w = i
l.o = f
f.s = i
f.z = i
i.z = f
assert f.z.z.z.txt == "i"