reads in data correctly and prints correctly