redirected to output.txt for p4-6