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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

d = A("d")
a = B("a")
n = C("n")
m = D("m")
i = E("i")
c = B("c")
g = A("g")
k = D("k")

d.w = i
d.s = i
d.t = n
d.v = g
d.o = g
a.q = m
a.s = c
a.x = d
n.x = m
n.o = c
m.s = i
m.w = c
i.z = k
c.q = m
c.s = a
c.x = d
g.w = i
g.s = i
g.t = n
g.v = d
g.o = d
k.s = i
k.w = c
assert a.q.s.z.w.s.x.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: C = None
        self.s: E = None
        self.v: A = None
        self.o: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

d = A("d")
a = B("a")
n = C("n")
m = D("m")
i = E("i")
c = B("c")
g = A("g")
k = D("k")

d.w = i
d.s = i
d.t = n
d.v = g
d.o = g
a.q = m
a.s = c
a.x = d
n.x = m
n.o = c
m.s = i
m.w = c
i.z = k
c.q = m
c.s = a
c.x = d
g.w = i
g.s = i
g.t = n
g.v = d
g.o = d
k.s = i
k.w = c
assert a.q.s.z.w.s.x.v.w.txt == "i"