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

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

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

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

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

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

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

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

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

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

n.z = a
n.o = a
n.p = e
n.x = h
f.w = m
e.t = n
e.v = n
a.u = n
a.y = e
m.w = f
h.z = a
h.o = a
h.p = e
h.x = n
assert a.u.z.y.t.txt == "n"