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

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

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

k = A("k")
n = B("n")
b = C("b")
l = A("l")
i = C("i")

k.x = n
k.w = b
n.x = k
b.v = n
b.s = n
b.o = k
l.x = n
l.w = i
i.v = n
i.s = n
i.o = k
assert l.w.v.x.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: C = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
b = C("b")
l = A("l")
i = C("i")

k.x = n
k.w = b
n.x = k
b.v = n
b.s = n
b.o = k
l.x = n
l.w = i
i.v = n
i.s = n
i.o = k
assert l.w.v.x.w.o.txt == "k"