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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: D = None
        self.o: C = None
        self.txt = txt

j = A("j")
g = B("g")
m = C("m")
l = D("l")
i = D("i")
a = D("a")

j.s = i
j.u = i
j.w = l
g.r = m
g.w = m
g.p = a
m.w = l
m.t = j
m.v = i
l.y = g
l.t = i
l.o = m
i.y = g
i.t = a
i.o = m
a.y = g
a.t = i
a.o = m
assert m.w.o.w.t.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: D = None
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: D = None
        self.o: C = None
        self.txt = txt

j = A("j")
g = B("g")
m = C("m")
l = D("l")
i = D("i")
a = D("a")

j.s = i
j.u = i
j.w = l
g.r = m
g.w = m
g.p = a
m.w = l
m.t = j
m.v = i
l.y = g
l.t = i
l.o = m
i.y = g
i.t = a
i.o = m
a.y = g
a.t = i
a.o = m
assert m.w.o.w.t.y.w.txt == "m"