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

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

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

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

n = A("n")
i = B("i")
h = C("h")
f = D("f")
a = D("a")
b = D("b")
e = A("e")
j = B("j")

n.z = h
i.w = j
i.t = a
i.v = e
h.p = n
h.v = n
f.z = h
f.x = b
f.o = b
f.t = n
a.z = h
a.x = b
a.o = f
a.t = e
b.z = h
b.x = a
b.o = f
b.t = e
e.z = h
j.w = i
j.t = a
j.v = e
assert f.z.p.z.v.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

n = A("n")
i = B("i")
h = C("h")
f = D("f")
a = D("a")
b = D("b")
e = A("e")
j = B("j")

n.z = h
i.w = j
i.t = a
i.v = e
h.p = n
h.v = n
f.z = h
f.x = b
f.o = b
f.t = n
a.z = h
a.x = b
a.o = f
a.t = e
b.z = h
b.x = a
b.o = f
b.t = e
e.z = h
j.w = i
j.t = a
j.v = e
assert f.z.p.z.v.z.v.txt == "n"