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

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

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

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

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

h.z = a
c.t = h
c.x = l
c.u = l
c.p = i
b.s = c
j.o = n
j.z = b
j.v = c
j.x = l
f.s = c
l.o = c
l.z = i
l.v = n
l.x = j
g.s = c
i.s = n
n.t = a
n.x = j
n.u = l
n.p = b
a.z = h
assert b.s.t.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

h.z = a
c.t = h
c.x = l
c.u = l
c.p = i
b.s = c
j.o = n
j.z = b
j.v = c
j.x = l
f.s = c
l.o = c
l.z = i
l.v = n
l.x = j
g.s = c
i.s = n
n.t = a
n.x = j
n.u = l
n.p = b
a.z = h
assert b.s.t.z.z.txt == "h"