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

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

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

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

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

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

l.v = g
l.p = i
g.z = i
g.v = l
i.u = n
n.y = e
n.w = e
e.u = l
assert i.u.w.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

l.v = g
l.p = i
g.z = i
g.v = l
i.u = n
n.y = e
n.w = e
e.u = l
assert i.u.w.u.p.txt == "i"