Pythagoras triplet(test cases failed

my code runs well in eclipse ,but in online ide it pass 1 out of 5 test cases,please help me to pass all the test cases.

import java.util.Scanner;

public class Pytho_Triplets {

public static void main(String[] args) {

	Scanner s = new Scanner(System.in);
	long n = s.nextLong();
	long p, q, a, b, c;
	if (n == 1 || n == 2) {
		System.out.print("-1");
	} else if (n % 2 != 0) {
		p = (n + 1) / 2;
		q = (n - 1) / 2;
		a = (p + q) * (p - q);
		b = 2 * p * q;
		c = (p * p) + (q * q);
		System.out.print(a + " ");
		System.out.print(b + " ");
		System.out.print(c + " ");

	} else if (n % 2 == 0) {
		p = n / 2;
		q = 1;
		a = (p + q) * (p - q);
		b = 2 * p * q;
		c = (p * p) + (q * q);
		if (n == 4) {
			System.out.print(a + " ");
			System.out.print(b + " ");
			System.out.print(c + " ");
		} else {
			System.out.print(b + " ");
			System.out.print(a + " ");
			System.out.print(c + " ");
		}
	}

}

}

Hi Ajith,
See you have to only print two numbers other than input.