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

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

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

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

h = A("h")
e = B("e")
f = C("f")
j = D("j")
a = B("a")
b = A("b")
d = A("d")
n = B("n")
g = A("g")
m = B("m")

h.z = n
e.o = j
e.y = f
e.t = h
e.v = g
f.w = j
f.o = j
f.s = m
j.z = n
a.o = j
a.y = f
a.t = b
a.v = b
b.z = a
d.z = m
n.o = j
n.y = f
n.t = h
n.v = b
g.z = e
m.o = j
m.y = f
m.t = d
m.v = d
assert j.z.o.z.y.s.t.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

h = A("h")
e = B("e")
f = C("f")
j = D("j")
a = B("a")
b = A("b")
d = A("d")
n = B("n")
g = A("g")
m = B("m")

h.z = n
e.o = j
e.y = f
e.t = h
e.v = g
f.w = j
f.o = j
f.s = m
j.z = n
a.o = j
a.y = f
a.t = b
a.v = b
b.z = a
d.z = m
n.o = j
n.y = f
n.t = h
n.v = b
g.z = e
m.o = j
m.y = f
m.t = d
m.v = d
assert j.z.o.z.y.s.t.z.o.txt == "j"