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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: A = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

h = A("h")
l = B("l")
a = C("a")
n = D("n")
m = E("m")
e = D("e")
i = A("i")
d = C("d")

h.y = m
l.z = d
a.u = d
n.o = l
n.u = l
n.q = l
n.w = h
m.q = l
m.p = e
m.o = i
e.o = l
e.u = l
e.q = l
e.w = h
i.y = m
d.u = a
assert e.w.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: A = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

h = A("h")
l = B("l")
a = C("a")
n = D("n")
m = E("m")
e = D("e")
i = A("i")
d = C("d")

h.y = m
l.z = d
a.u = d
n.o = l
n.u = l
n.q = l
n.w = h
m.q = l
m.p = e
m.o = i
e.o = l
e.u = l
e.q = l
e.w = h
i.y = m
d.u = a
assert e.w.y.p.txt == "e"