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

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

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

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

j = A("j")
e = B("e")
d = C("d")
a = D("a")
c = A("c")
l = C("l")
n = D("n")
g = A("g")

j.w = n
j.p = l
j.z = g
e.s = a
e.x = l
d.o = l
d.x = e
a.w = e
a.s = l
a.p = g
c.w = n
c.p = l
c.z = g
l.o = d
l.x = e
n.w = e
n.s = l
n.p = j
g.w = a
g.p = l
g.z = j
assert g.z.w.w.s.w.s.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: C = None
        self.z: A = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
d = C("d")
a = D("a")
c = A("c")
l = C("l")
n = D("n")
g = A("g")

j.w = n
j.p = l
j.z = g
e.s = a
e.x = l
d.o = l
d.x = e
a.w = e
a.s = l
a.p = g
c.w = n
c.p = l
c.z = g
l.o = d
l.x = e
n.w = e
n.s = l
n.p = j
g.w = a
g.p = l
g.z = j
assert g.z.w.w.s.w.s.p.z.txt == "j"