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

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

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

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

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

h.w = c
h.z = c
h.y = m
h.t = n
e.q = c
e.o = n
c.t = h
l.s = e
l.z = e
l.u = e
l.o = k
g.w = c
g.z = c
g.y = m
g.t = l
a.w = c
a.z = c
a.y = m
a.t = l
k.w = c
k.z = c
k.y = l
k.t = n
m.s = e
m.z = e
m.u = e
m.o = a
n.s = e
n.z = e
n.u = e
n.o = h
assert n.s.q.t.t.z.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: D = None
        self.t: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

h.w = c
h.z = c
h.y = m
h.t = n
e.q = c
e.o = n
c.t = h
l.s = e
l.z = e
l.u = e
l.o = k
g.w = c
g.z = c
g.y = m
g.t = l
a.w = c
a.z = c
a.y = m
a.t = l
k.w = c
k.z = c
k.y = l
k.t = n
m.s = e
m.z = e
m.u = e
m.o = a
n.s = e
n.z = e
n.u = e
n.o = h
assert n.s.q.t.t.z.q.t.txt == "h"