3rd assignment (Floyd's algorithm)