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

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

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

i = A("i")
c = B("c")
f = C("f")
e = B("e")
k = A("k")

i.v = k
i.x = e
i.s = e
c.s = f
c.w = f
c.v = k
f.x = k
f.r = i
f.s = c
e.s = f
e.w = f
e.v = i
k.v = i
k.x = c
k.s = c
assert f.x.v.x.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: B = None
        self.s: B = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
f = C("f")
e = B("e")
k = A("k")

i.v = k
i.x = e
i.s = e
c.s = f
c.w = f
c.v = k
f.x = k
f.r = i
f.s = c
e.s = f
e.w = f
e.v = i
k.v = i
k.x = c
k.s = c
assert f.x.v.x.v.v.txt == "k"