Qatar to take legal action against Gulf states