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

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

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

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

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

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

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

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

i.s = k
k.y = l
k.u = i
k.r = n
l.w = n
l.u = i
l.x = k
b.w = n
b.x = n
b.u = i
n.y = b
n.u = i
n.r = k
assert l.w.u.s.y.txt == "l"