class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: A = None
        self.v: E = None
        self.p: A = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: B = None
        self.p: B = None
        self.z: B = None
        self.x: E = None
        self.txt = txt

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

h = A("h")
m = B("m")
d = C("d")
n = D("n")
e = E("e")
g = C("g")
f = A("f")
i = D("i")

h.z = m
h.x = f
h.p = f
h.v = e
h.r = e
m.w = d
d.v = n
d.o = g
d.y = g
d.t = m
d.z = m
n.y = i
n.s = m
n.p = m
n.z = m
n.x = e
e.z = m
g.v = n
g.o = d
g.y = d
g.t = m
g.z = m
f.z = m
f.x = h
f.p = h
f.v = e
f.r = e
i.y = n
i.s = m
i.p = m
i.z = m
i.x = e
assert f.p.z.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: A = None
        self.v: E = None
        self.p: A = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: B = None
        self.p: B = None
        self.z: B = None
        self.x: E = None
        self.txt = txt

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

h = A("h")
m = B("m")
d = C("d")
n = D("n")
e = E("e")
g = C("g")
f = A("f")
i = D("i")

h.z = m
h.x = f
h.p = f
h.v = e
h.r = e
m.w = d
d.v = n
d.o = g
d.y = g
d.t = m
d.z = m
n.y = i
n.s = m
n.p = m
n.z = m
n.x = e
e.z = m
g.v = n
g.o = d
g.y = d
g.t = m
g.z = m
f.z = m
f.x = h
f.p = h
f.v = e
f.r = e
i.y = n
i.s = m
i.p = m
i.z = m
i.x = e
assert f.p.z.w.o.txt == "g"