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

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

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

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

j = A("j")
n = B("n")
e = C("e")
a = D("a")
m = B("m")
k = A("k")

j.y = n
j.z = n
n.v = e
n.o = e
e.x = j
a.t = k
m.v = e
m.o = e
k.y = n
k.z = n
assert n.o.x.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
e = C("e")
a = D("a")
m = B("m")
k = A("k")

j.y = n
j.z = n
n.v = e
n.o = e
e.x = j
a.t = k
m.v = e
m.o = e
k.y = n
k.z = n
assert n.o.x.z.v.txt == "e"