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

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

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

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

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

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

e.p = l
e.u = l
e.y = h
e.x = i
l.w = k
l.v = e
k.q = l
k.x = l
k.y = i
k.p = e
k.r = e
h.y = e
h.r = i
i.r = l
i.v = l
assert i.r.v.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: D = None
        self.x: E = None
        self.u: B = None
        self.txt = txt

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

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

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

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

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

e.p = l
e.u = l
e.y = h
e.x = i
l.w = k
l.v = e
k.q = l
k.x = l
k.y = i
k.p = e
k.r = e
h.y = e
h.r = i
i.r = l
i.v = l
assert i.r.v.x.r.txt == "l"