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

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

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

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

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

l = A("l")
b = B("b")
j = C("j")
n = D("n")
a = E("a")

l.r = n
l.z = a
b.w = l
j.v = b
j.x = l
j.w = n
n.w = j
n.o = a
a.z = n
a.y = l
a.w = j
assert j.v.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: E = None
        self.txt = txt

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

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

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

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

l = A("l")
b = B("b")
j = C("j")
n = D("n")
a = E("a")

l.r = n
l.z = a
b.w = l
j.v = b
j.x = l
j.w = n
n.w = j
n.o = a
a.z = n
a.y = l
a.w = j
assert j.v.w.z.txt == "a"