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

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

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

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

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

n.s = g
n.w = a
n.x = a
n.t = e
a.r = e
a.p = n
a.o = l
a.s = f
j.y = n
j.o = n
f.r = g
f.w = a
f.z = l
e.r = a
e.p = n
e.o = l
e.s = f
l.r = e
l.o = e
l.p = n
l.s = f
g.y = n
g.o = n
assert g.y.s.y.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: B = None
        self.t: B = None
        self.x: B = None
        self.txt = txt

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

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

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

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

n.s = g
n.w = a
n.x = a
n.t = e
a.r = e
a.p = n
a.o = l
a.s = f
j.y = n
j.o = n
f.r = g
f.w = a
f.z = l
e.r = a
e.p = n
e.o = l
e.s = f
l.r = e
l.o = e
l.p = n
l.s = f
g.y = n
g.o = n
assert g.y.s.y.w.p.txt == "n"