package com.codegym.task.task07.task0713;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Playing Javarella
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> mainList = new ArrayList<Integer>();
ArrayList<Integer> sup1 = new ArrayList<Integer>();
ArrayList<Integer> sup2 = new ArrayList<Integer>();
ArrayList<Integer> sup3 = new ArrayList<Integer>();
for(int i = 0; i < 20; i++) {
int n = Integer.parseInt(br.readLine());
mainList.add(n);
}
for(Integer j : mainList) {
if(j % 3 == 0) {
sup1.add(j);
}
if(j % 2 == 0) {
sup2.add(j);
}
if(j % 2 == 0 && j % 3 == 0) {
sup3.add(j);
}
}
printList(sup1);
printList(sup2);
printList(sup3);
}
public static void printList(List<Integer> list) {
for(Integer x : list) System.out.println(x);
}
}
package com.codegym.task.task07.task0713;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Playing Javarella
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> mainList = new ArrayList<Integer>();
ArrayList<Integer> sup1 = new ArrayList<Integer>();
ArrayList<Integer> sup2 = new ArrayList<Integer>();
ArrayList<Integer> sup3 = new ArrayList<Integer>();
for(int i = 0; i < 20; i++) {
int n = Integer.parseInt(br.readLine());
mainList.add(n);
}
for(Integer j : mainList) {
if(j % 3 == 0) {
sup1.add(j);
}
if(j % 2 == 0) {
sup2.add(j);
}
if(j % 2 == 0 && j % 3 == 0) {
sup3.add(j);
}
}
printList(sup1);
printList(sup2);
printList(sup3);
}
public static void printList(List<Integer> list) {
for(Integer x : list) System.out.println(x);
}
}