Input (grade 8): Piauí is bounded on the west by Maranhão, on the east by Ceará, Pernambuco and Bahia, and on the south by Tocantins.
Output (grade 7): Piauí shares borders with the states of Maranhão (west), Ceará (east), Pernambuco (east) and Bahia (east and south).