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

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

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

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

n = A("n")
a = B("a")
k = C("k")
g = D("g")
j = C("j")
c = B("c")
i = B("i")
h = A("h")
e = A("e")
l = A("l")

n.z = c
a.w = g
a.y = j
a.q = e
k.s = c
k.x = c
k.r = g
g.o = a
g.r = a
g.p = c
g.x = e
j.s = i
j.x = i
j.r = g
c.w = g
c.y = j
c.q = n
i.w = g
i.y = j
i.q = e
h.z = a
e.z = a
l.z = c
assert a.w.p.y.s.y.r.o.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

n = A("n")
a = B("a")
k = C("k")
g = D("g")
j = C("j")
c = B("c")
i = B("i")
h = A("h")
e = A("e")
l = A("l")

n.z = c
a.w = g
a.y = j
a.q = e
k.s = c
k.x = c
k.r = g
g.o = a
g.r = a
g.p = c
g.x = e
j.s = i
j.x = i
j.r = g
c.w = g
c.y = j
c.q = n
i.w = g
i.y = j
i.q = e
h.z = a
e.z = a
l.z = c
assert a.w.p.y.s.y.r.o.y.r.txt == "g"