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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: A = None
        self.s: A = None
        self.o: A = None
        self.txt = txt

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

a = A("a")
e = B("e")
b = C("b")
k = D("k")
i = E("i")

a.u = e
a.v = b
e.v = i
b.x = i
b.s = e
k.q = a
k.y = a
k.s = a
k.o = a
i.u = a
assert e.v.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: A = None
        self.s: A = None
        self.o: A = None
        self.txt = txt

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

a = A("a")
e = B("e")
b = C("b")
k = D("k")
i = E("i")

a.u = e
a.v = b
e.v = i
b.x = i
b.s = e
k.q = a
k.y = a
k.s = a
k.o = a
i.u = a
assert e.v.u.u.txt == "e"