class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: A = None
        self.t: 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.r: B = None
        self.txt = txt

k = A("k")
m = B("m")
e = C("e")
j = B("j")
l = B("l")
i = A("i")
a = B("a")
n = A("n")
c = C("c")

k.s = l
k.r = i
k.t = c
m.w = c
e.r = l
j.w = c
l.w = e
i.s = a
i.r = k
i.t = c
a.w = c
n.s = m
n.r = i
n.t = c
c.r = j
assert m.w.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: A = None
        self.t: 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.r: B = None
        self.txt = txt

k = A("k")
m = B("m")
e = C("e")
j = B("j")
l = B("l")
i = A("i")
a = B("a")
n = A("n")
c = C("c")

k.s = l
k.r = i
k.t = c
m.w = c
e.r = l
j.w = c
l.w = e
i.s = a
i.r = k
i.t = c
a.w = c
n.s = m
n.r = i
n.t = c
c.r = j
assert m.w.r.w.r.txt == "j"