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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: A = None
        self.t: A = None
        self.r: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.p: C = None
        self.x: C = None
        self.u: A = None
        self.txt = txt

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

n = A("n")
l = B("l")
k = C("k")
h = D("h")
a = E("a")
e = A("e")

n.x = a
n.z = h
n.y = k
l.x = k
l.z = n
l.t = e
l.r = a
k.q = h
k.r = a
h.q = l
h.t = l
h.p = k
h.x = k
h.u = e
a.o = k
a.x = k
e.x = a
e.z = h
e.y = k
assert n.y.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: D = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: A = None
        self.t: A = None
        self.r: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.p: C = None
        self.x: C = None
        self.u: A = None
        self.txt = txt

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

n = A("n")
l = B("l")
k = C("k")
h = D("h")
a = E("a")
e = A("e")

n.x = a
n.z = h
n.y = k
l.x = k
l.z = n
l.t = e
l.r = a
k.q = h
k.r = a
h.q = l
h.t = l
h.p = k
h.x = k
h.u = e
a.o = k
a.x = k
e.x = a
e.z = h
e.y = k
assert n.y.r.x.txt == "k"