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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.txt = txt

l = A("l")
f = B("f")
a = C("a")
c = C("c")

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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.txt = txt

l = A("l")
f = B("f")
a = C("a")
c = C("c")

l.s = a
l.w = f
l.z = c
f.r = l
f.v = l
f.o = a
a.v = c
a.w = c
c.v = a
c.w = a
assert a.w.v.w.w.txt == "a"