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

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

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

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

i.r = n
i.u = k
n.s = k
k.v = i
k.y = i
assert n.s.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: C = None
        self.txt = txt

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

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

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

i.r = n
i.u = k
n.s = k
k.v = i
k.y = i
assert n.s.v.r.txt == "n"