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

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

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

i = A("i")
d = B("d")
b = C("b")
l = B("l")
n = A("n")
k = B("k")
c = A("c")
f = C("f")
a = A("a")

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

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

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

i = A("i")
d = B("d")
b = C("b")
l = B("l")
n = A("n")
k = B("k")
c = A("c")
f = C("f")
a = A("a")

i.w = b
d.u = f
d.w = l
d.s = b
b.r = k
l.u = f
l.s = f
l.w = d
n.w = b
k.u = b
k.w = l
k.s = f
c.w = f
f.r = d
a.w = b
assert a.w.r.w.s.r.u.r.u.r.txt == "d"