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

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

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

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

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

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

l.z = i
j.v = l
j.z = l
h.u = e
i.z = l
e.v = i
e.w = h
e.y = j
e.q = l
assert h.u.v.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

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

l.z = i
j.v = l
j.z = l
h.u = e
i.z = l
e.v = i
e.w = h
e.y = j
e.q = l
assert h.u.v.z.z.txt == "i"