public class Solution { public static void main(String[] args) throws Exception { Scanner sc1 = new Scanner(System.in); ArrayList<String> list = new ArrayList<>(); for(int x = 0; x<5; x++){ String s = sc1.nextLine(); list.add(s); } for(int x = 0; x<13; x++) { String w = list.get(list.size()-1); list.remove(list.size()-1); list.add(0, w); } for(int x = 0; x<13; x++) { System.out.println(list); } } }