formatted output for query word files