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

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

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

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

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

n = A("n")
e = B("e")
c = C("c")
j = D("j")
m = E("m")
l = E("l")
i = C("i")
h = B("h")

n.x = m
n.p = m
n.y = l
e.o = c
e.w = h
c.q = l
j.x = i
j.y = e
m.q = j
m.t = l
m.x = n
m.w = e
l.q = j
l.t = m
l.x = n
l.w = h
i.q = m
h.o = c
h.w = e
assert c.q.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: E = None
        self.y: E = None
        self.txt = txt

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

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

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

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

n = A("n")
e = B("e")
c = C("c")
j = D("j")
m = E("m")
l = E("l")
i = C("i")
h = B("h")

n.x = m
n.p = m
n.y = l
e.o = c
e.w = h
c.q = l
j.x = i
j.y = e
m.q = j
m.t = l
m.x = n
m.w = e
l.q = j
l.t = m
l.x = n
l.w = h
i.q = m
h.o = c
h.w = e
assert c.q.q.y.txt == "e"