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

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

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

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

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

c = A("c")
a = B("a")
n = C("n")
h = D("h")
m = E("m")
j = A("j")

c.v = n
c.z = h
c.o = h
a.r = m
n.p = m
n.o = a
n.y = a
n.s = h
h.r = a
h.s = j
h.w = c
m.s = n
m.w = n
j.v = n
j.z = h
j.o = h
assert n.o.r.w.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

c = A("c")
a = B("a")
n = C("n")
h = D("h")
m = E("m")
j = A("j")

c.v = n
c.z = h
c.o = h
a.r = m
n.p = m
n.o = a
n.y = a
n.s = h
h.r = a
h.s = j
h.w = c
m.s = n
m.w = n
j.v = n
j.z = h
j.o = h
assert n.o.r.w.o.r.txt == "m"