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

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

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

d = A("d")
m = B("m")
b = C("b")
k = A("k")
a = B("a")
l = B("l")
e = C("e")
c = A("c")
h = B("h")

d.w = b
d.t = c
m.z = h
m.s = d
b.p = a
b.s = e
k.w = e
k.t = c
a.z = h
a.s = c
l.z = m
l.s = k
e.p = l
e.s = b
c.w = b
c.t = k
h.z = l
h.s = k
assert a.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: A = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
b = C("b")
k = A("k")
a = B("a")
l = B("l")
e = C("e")
c = A("c")
h = B("h")

d.w = b
d.t = c
m.z = h
m.s = d
b.p = a
b.s = e
k.w = e
k.t = c
a.z = h
a.s = c
l.z = m
l.s = k
e.p = l
e.s = b
c.w = b
c.t = k
h.z = l
h.s = k
assert a.s.w.s.txt == "e"