import java.util.ArrayList; import java.util.Scanner; public class prog { public static void main( String[] args ) { int n; int m; int x, y, z; ArrayList operations = new ArrayList(); ArrayList listaNr = new ArrayList(); int[] operation = new int[3]; Scanner scanner = new Scanner(System.in); //read n and m String line = scanner.nextLine(); String[] strs = line.trim().split("\\s+"); n = Integer.parseInt(strs[0]); m = Integer.parseInt(strs[1]); //System.out.print(n + " " + m); //read operations for(int i = 0; i 0) { lower--; if (listaNr.get(lower) != nr) { ok = false; boundaries[1] = lower + 2; break; } } if (ok) boundaries[1] = lower + 1; ok = true; while(upper < listaNr.size() - 1) { upper++; if (listaNr.get(upper) != nr) { ok = false; boundaries[2] = upper; break; } } if (ok) boundaries[2] = upper + 1; System.out.print(boundaries[0] + " " + boundaries[1] + " " + boundaries[2] + "\n"); } } } }