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

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

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

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

k.s = e
e.q = c
e.y = i
i.q = k
c.q = e
c.y = i
assert k.s.q.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

k.s = e
e.q = c
e.y = i
i.q = k
c.q = e
c.y = i
assert k.s.q.y.q.txt == "k"