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

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

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

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

d = A("d")
h = B("h")
j = C("j")
l = D("l")
a = D("a")
e = C("e")
c = D("c")
n = A("n")
f = B("f")

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

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

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

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

d = A("d")
h = B("h")
j = C("j")
l = D("l")
a = D("a")
e = C("e")
c = D("c")
n = A("n")
f = B("f")

d.z = h
h.o = f
h.t = n
h.s = a
h.z = c
j.v = l
l.s = n
l.t = a
l.w = f
a.s = n
a.t = l
a.w = h
e.v = c
c.s = d
c.t = l
c.w = f
n.z = f
f.o = h
f.t = n
f.s = l
f.z = a
assert c.t.s.z.z.w.txt == "h"