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

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

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

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

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

i = A("i")
l = B("l")
h = C("h")
n = D("n")
g = E("g")

i.u = g
i.v = g
i.x = l
l.x = h
l.o = g
l.t = i
h.w = n
h.q = l
n.w = i
g.p = n
assert h.w.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: B = None
        self.v: E = None
        self.txt = txt

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

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

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

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

i = A("i")
l = B("l")
h = C("h")
n = D("n")
g = E("g")

i.u = g
i.v = g
i.x = l
l.x = h
l.o = g
l.t = i
h.w = n
h.q = l
n.w = i
g.p = n
assert h.w.w.x.txt == "l"