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

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

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

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

a.y = l
a.r = l
k.w = l
l.w = a
l.u = a
assert k.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.txt = txt

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

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

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

a.y = l
a.r = l
k.w = l
l.w = a
l.u = a
assert k.w.w.r.txt == "l"