use stdout.write instead of print