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

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

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

a = A("a")
l = B("l")
e = C("e")

a.t = l
a.y = l
a.s = e
l.q = e
l.t = a
e.v = a
e.y = a
assert l.q.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.y: B = None
        self.txt = txt

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

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

a = A("a")
l = B("l")
e = C("e")

a.t = l
a.y = l
a.s = e
l.q = e
l.t = a
e.v = a
e.y = a
assert l.q.v.s.txt == "e"