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

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

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

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

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

n.o = a
e.v = d
e.r = d
e.w = a
e.z = f
a.o = c
h.x = n
h.u = d
h.s = a
f.o = a
d.x = n
d.u = h
d.s = a
c.v = h
c.w = a
c.r = d
c.z = n
assert f.o.o.v.s.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

n.o = a
e.v = d
e.r = d
e.w = a
e.z = f
a.o = c
h.x = n
h.u = d
h.s = a
f.o = a
d.x = n
d.u = h
d.s = a
c.v = h
c.w = a
c.r = d
c.z = n
assert f.o.o.v.s.o.v.txt == "h"