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

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

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

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

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

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

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

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

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