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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: D = None
        self.txt = txt

a = A("a")
h = B("h")
c = C("c")
k = D("k")
i = E("i")
n = B("n")

a.x = i
h.w = a
h.s = a
h.v = c
h.r = n
c.o = h
c.x = h
c.u = a
c.t = k
k.z = n
k.u = a
k.w = h
k.x = h
i.v = a
i.s = k
n.w = a
n.s = a
n.v = c
n.r = h
assert i.s.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: D = None
        self.txt = txt

a = A("a")
h = B("h")
c = C("c")
k = D("k")
i = E("i")
n = B("n")

a.x = i
h.w = a
h.s = a
h.v = c
h.r = n
c.o = h
c.x = h
c.u = a
c.t = k
k.z = n
k.u = a
k.w = h
k.x = h
i.v = a
i.s = k
n.w = a
n.s = a
n.v = c
n.r = h
assert i.s.u.x.txt == "i"