A hand-drawn Islamic State flag was found in the room of the 17-year-old who attacked passengers on a train in southern Germany with an ax.