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

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

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

j = A("j")
l = B("l")
f = C("f")
e = B("e")
n = C("n")
i = A("i")

j.s = e
l.w = j
l.t = n
f.x = e
f.w = n
e.w = i
e.t = f
n.x = e
n.w = f
i.s = l
assert l.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
f = C("f")
e = B("e")
n = C("n")
i = A("i")

j.s = e
l.w = j
l.t = n
f.x = e
f.w = n
e.w = i
e.t = f
n.x = e
n.w = f
i.s = l
assert l.w.s.w.txt == "i"