/* package whatever; // don't place package name! */

import java.util.*;
import java.util.stream.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone {
	public static void main (String[] args) throws java.lang.Exception	{
		Integer[] unsorted = new Integer[] { 1, 2, 3, 8, 4, 5, 6, 7 };
		Double[] sorted = new Double[] { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
		try {
			Arrays.stream(unsorted).reduce((last, curr) -> {
				System.out.println("check");
				if (((Comparable) curr).compareTo(last) < 0) {
					throw new UnsupportedOperationException("");
				}

				return curr;
			});
			System.out.println("sorted");
		} catch (UnsupportedOperationException e) {
			System.out.println("unsorted");
		}
		try {
			Arrays.stream(sorted).reduce((last, curr) -> {
				System.out.println("check");
				if (((Comparable) curr).compareTo(last) < 0) {
					throw new UnsupportedOperationException();
				}

				return curr;
			});
			System.out.println("sorted");
		} catch (UnsupportedOperationException e) {
			System.out.println("unsorted");
		}
	}
}
