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

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

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

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

k = A("k")
c = B("c")
i = C("i")
a = D("a")
n = B("n")
l = A("l")
m = A("m")
f = B("f")

k.o = i
k.s = n
k.w = m
c.r = i
c.t = i
c.p = l
i.s = c
a.u = m
n.r = i
n.t = i
n.p = l
l.o = i
l.s = n
l.w = m
m.o = i
m.s = f
m.w = l
f.r = i
f.t = i
f.p = m
assert l.s.t.s.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: B = None
        self.w: A = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
i = C("i")
a = D("a")
n = B("n")
l = A("l")
m = A("m")
f = B("f")

k.o = i
k.s = n
k.w = m
c.r = i
c.t = i
c.p = l
i.s = c
a.u = m
n.r = i
n.t = i
n.p = l
l.o = i
l.s = n
l.w = m
m.o = i
m.s = f
m.w = l
f.r = i
f.t = i
f.p = m
assert l.s.t.s.r.s.r.txt == "i"