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

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

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

e = A("e")
c = B("c")
l = C("l")
k = C("k")

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

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

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

e = A("e")
c = B("c")
l = C("l")
k = C("k")

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