class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: E = None
        self.z: C = None
        self.v: C = None
        self.w: D = None
        self.txt = txt

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

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

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

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

n = A("n")
g = B("g")
k = C("k")
a = D("a")
c = E("c")
m = D("m")
i = E("i")
b = A("b")

n.q = k
n.z = k
n.v = k
n.u = i
n.w = a
g.r = k
g.p = k
k.o = c
a.u = m
c.w = i
c.r = g
c.v = m
c.x = b
m.u = a
i.w = c
i.r = g
i.v = m
i.x = b
b.q = k
b.z = k
b.v = k
b.u = c
b.w = a
assert n.u.x.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: E = None
        self.z: C = None
        self.v: C = None
        self.w: D = None
        self.txt = txt

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

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

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

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

n = A("n")
g = B("g")
k = C("k")
a = D("a")
c = E("c")
m = D("m")
i = E("i")
b = A("b")

n.q = k
n.z = k
n.v = k
n.u = i
n.w = a
g.r = k
g.p = k
k.o = c
a.u = m
c.w = i
c.r = g
c.v = m
c.x = b
m.u = a
i.w = c
i.r = g
i.v = m
i.x = b
b.q = k
b.z = k
b.v = k
b.u = c
b.w = a
assert n.u.x.w.u.txt == "m"