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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: D = None
        self.w: E = None
        self.p: A = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

c = A("c")
n = B("n")
f = C("f")
b = D("b")
e = E("e")
i = E("i")
k = D("k")
h = B("h")
m = B("m")

c.p = n
c.z = n
c.s = i
c.x = i
c.w = m
n.x = b
n.y = b
n.w = e
n.p = c
n.u = k
f.z = e
f.p = e
f.x = c
f.r = i
f.w = m
b.z = c
e.q = b
i.q = k
k.z = c
h.x = b
h.y = b
h.w = i
h.p = c
h.u = k
m.x = k
m.u = k
m.y = b
m.w = e
m.p = c
assert n.u.z.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.s: E = None
        self.w: B = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: D = None
        self.w: E = None
        self.p: A = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

c = A("c")
n = B("n")
f = C("f")
b = D("b")
e = E("e")
i = E("i")
k = D("k")
h = B("h")
m = B("m")

c.p = n
c.z = n
c.s = i
c.x = i
c.w = m
n.x = b
n.y = b
n.w = e
n.p = c
n.u = k
f.z = e
f.p = e
f.x = c
f.r = i
f.w = m
b.z = c
e.q = b
i.q = k
k.z = c
h.x = b
h.y = b
h.w = i
h.p = c
h.u = k
m.x = k
m.u = k
m.y = b
m.w = e
m.p = c
assert n.u.z.z.w.txt == "e"