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

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

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

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

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

e = A("e")
m = B("m")
i = C("i")
l = D("l")
b = E("b")

e.p = m
e.r = i
m.v = b
m.w = e
i.p = m
i.t = m
i.q = l
i.v = e
i.u = e
l.q = b
l.u = e
l.t = i
b.o = e
b.v = m
b.q = m
b.y = l
assert i.q.t.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: C = None
        self.txt = txt

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

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

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

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

e = A("e")
m = B("m")
i = C("i")
l = D("l")
b = E("b")

e.p = m
e.r = i
m.v = b
m.w = e
i.p = m
i.t = m
i.q = l
i.v = e
i.u = e
l.q = b
l.u = e
l.t = i
b.o = e
b.v = m
b.q = m
b.y = l
assert i.q.t.v.r.txt == "i"