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

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

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

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

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

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

m.w = e
m.y = d
m.z = j
m.x = j
h.r = a
n.v = e
n.o = e
n.x = h
d.o = h
d.r = e
d.s = n
d.x = m
j.o = n
e.o = h
e.r = d
e.s = n
e.x = m
a.w = e
a.y = d
a.z = j
a.x = j
k.r = m
assert a.w.o.r.y.o.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: D = None
        self.z: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

m.w = e
m.y = d
m.z = j
m.x = j
h.r = a
n.v = e
n.o = e
n.x = h
d.o = h
d.r = e
d.s = n
d.x = m
j.o = n
e.o = h
e.r = d
e.s = n
e.x = m
a.w = e
a.y = d
a.z = j
a.x = j
k.r = m
assert a.w.o.r.y.o.r.z.txt == "j"