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

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

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

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

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

g.z = n
g.x = n
g.t = e
g.y = l
f.x = l
f.v = a
h.v = l
h.t = f
h.w = g
e.u = f
e.x = a
i.u = f
i.x = h
a.v = g
a.t = f
a.w = l
n.u = f
n.x = a
l.z = i
l.x = n
l.t = e
l.y = g
assert n.x.v.t.x.v.y.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.t: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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

g.z = n
g.x = n
g.t = e
g.y = l
f.x = l
f.v = a
h.v = l
h.t = f
h.w = g
e.u = f
e.x = a
i.u = f
i.x = h
a.v = g
a.t = f
a.w = l
n.u = f
n.x = a
l.z = i
l.x = n
l.t = e
l.y = g
assert n.x.v.t.x.v.y.z.x.txt == "h"