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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: A = None
        self.txt = txt

k = A("k")
g = B("g")
f = C("f")
a = D("a")
m = C("m")
n = C("n")
d = C("d")
e = B("e")
l = A("l")

k.s = e
k.w = l
g.w = a
g.x = e
g.q = d
f.r = k
f.p = e
f.y = g
a.o = g
a.p = k
m.r = k
m.p = g
m.y = g
n.r = k
n.p = g
n.y = e
d.r = l
d.p = e
d.y = g
e.w = a
e.x = g
e.q = m
l.s = e
l.w = k
assert k.s.w.p.w.s.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: A = None
        self.txt = txt

k = A("k")
g = B("g")
f = C("f")
a = D("a")
m = C("m")
n = C("n")
d = C("d")
e = B("e")
l = A("l")

k.s = e
k.w = l
g.w = a
g.x = e
g.q = d
f.r = k
f.p = e
f.y = g
a.o = g
a.p = k
m.r = k
m.p = g
m.y = g
n.r = k
n.p = g
n.y = e
d.r = l
d.p = e
d.y = g
e.w = a
e.x = g
e.q = m
l.s = e
l.w = k
assert k.s.w.p.w.s.x.x.txt == "e"