import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class D14 implements Runnable {
	private InputReader in;
	private PrintWriter out;

	public static void main(String[] args) {
		new D14().run();
	}

	public D14() {
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
	}

	private static final int INF = 1000000000;
	private static final int MAXN = 200+5;

	int NOCOLOR = 0;
	int YELLOW = 1;
	int GREEN = 2;
	int[] color = new int[MAXN];
	boolean[] visited = new boolean[MAXN];
	Deque<Integer> queue = new ArrayDeque<Integer>();
	void flood(int split) {
	    Arrays.fill(color, NOCOLOR);

	    color[as[split]] = YELLOW;
	    color[bs[split]] = GREEN;

	    queue.add(as[split]);
	    while (!queue.isEmpty()) {
	        int v = queue.pollFirst();
	        color[v] = YELLOW;
	        for (int v2 : edges[v])
	            if (color[v2] == NOCOLOR)
	                queue.add(v2);

	    }

	    queue.add(bs[split]);
	    while (!queue.isEmpty()) {
	        int v = queue.pollFirst();
	        color[v] = GREEN;
	        for (int v2 : edges[v])
	            if (color[v2] == NOCOLOR)
    	            queue.add(v2);
	    }

	    //for (int i = 0; i < N; i++)
	    //    System.out.println(color[i]);
	}

	int N;
	int[] as = new int[MAXN];
	int[] bs = new int[MAXN];
	boolean[][] connect = new boolean[MAXN][MAXN];
	List<Integer>[] edges = new ArrayList[MAXN];
	int[][] dist = new int[MAXN][MAXN];
	public void run() {
        N = in.readInt();
        //System.out.println("A-2");
        for (int i = 0; i < N; i++) {
            edges[i] = new ArrayList<Integer>();
        }
        //System.out.println("A-1");
        // Read
        for (int i = 0; i < N-1; i++) {
            int p = in.readInt()-1;
            int q = in.readInt()-1;
            as[i] = p;
            bs[i] = q;
            connect[p][q] = true;
            connect[q][p] = true;
            edges[p].add(q);
            edges[q].add(p);
        }
        //System.out.println("A");
        // Ford
        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++) {
                dist[i][j] = connect[i][j] ? 1 : INF;
                if (i == j) dist[i][j] = 0;
            }
        for (int k = 0; k < N; k++)
            for (int i = 0; i < N; i++)
                for (int j = 0; j < N; j++)
                    dist[i][j] = Math.min(dist[i][j], dist[i][k]+dist[k][j]);

        /*for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++)
                System.out.print(dist[i][j]+" ");
            System.out.println();
        }*/
        //System.out.println("B");
        // Solve
        int best = 0;
        for (int i = 0; i < N-1; i++) {
            flood(i);
            int yellowbest = 0;
            int greenbest = 0;
            for (int j = 0; j < N; j++)
                for (int k = 0; k < N; k++) {
                    if (color[j] == color[k] && color[k] == YELLOW)
                        yellowbest = Math.max(yellowbest, dist[j][k]);
                    if (color[j] == color[k] && color[k] == GREEN)
                        greenbest = Math.max(greenbest, dist[j][k]);
                }
           //System.out.println(i+" "+yellowbest+" "+greenbest);
           best = Math.max(best, yellowbest*greenbest);
        }
        //out.println("C");
        out.println(best);
		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1000];
		private int curChar, numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0)
				s = readLine0();
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines)
				return readLine();
			else
				return readLine0();
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(readString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char readCharacter() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			return (char) c;
		}

		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
	}
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        ArrayList<Integer> lst = null;
        if (pred == -1)
            lst = new ArrayList<Integer>();
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            int t = maxDepth(v, u) + 1;
            res = max(res, t);
            if (pred == -1)
                lst.add(t);
        }
        if (ok == false)
            return 0;
        if (pred == -1) {
            Collections.sort(lst);
            if (lst.size() > 1)
                return lst.get(lst.size() - 1) + lst.get(lst.size() - 2);
        }
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j] && g[j].size() == 1)
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        /*
         * for (v = 0; v < n; ++v) if (g[v].size() == 1) dfs(v, 0);
         */
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < g[i].size(); ++j) {
                int u = g[i].get(j);

                was[u] = true;
                int a = maxDepth(-1, i);

                for (int k = 0; k < n; ++k)
                    if (k != u)
                        a = max(a, maxDepth(-1, k));

                was[u] = false;

                was[i] = true;
                int b = maxDepth(-1, u);

                for (int k = 0; k < n; ++k)
                    if (k != i)
                        b = max(b, maxDepth(-1, k));

                was[i] = false;

                ans = max(ans, a * b);
            }
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            res = max(res, maxDepth(v, u) + 1);
        }
        if (ok == false)
            return 0;
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j] && g[j].size() == 1)
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        // dfs(v, 0);
        for (v = 0; v < n; ++v)
            dfs(v, 0);
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            res = max(res, maxDepth(v, u) + 1);
        }
        if (ok == false)
            return 0;
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j] && g[j].size() == 1)
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        for (v = 0; v < n; ++v)
            if (g[v].size() == 1)
                dfs(v, 0);
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        ArrayList<Integer> lst = null;
        if (pred == -1)
            lst = new ArrayList<Integer>();
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            int t = maxDepth(v, u) + 1;
            res = max(res, t);
            if (pred == -1)
                lst.add(t);
        }
        if (ok == false)
            return 0;
        if (pred == -1) {
            Collections.sort(lst);
            if (lst.size() > 1)
                return lst.get(lst.size() - 1) + lst.get(lst.size() - 2);
        }
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j] && g[j].size() == 1)
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];

          for (v = 0; v < n; ++v) if (g[v].size() == 1) dfs(v, 0);

        /*for (int i = 0; i < n; ++i)
            for (int j = 0; j < g[i].size(); ++j) {
                int u = g[i].get(j);

                was[u] = true;
                int a = maxDepth(-1, i);

                for (int k = 0; k < n; ++k)
                    if (k != u)
                        a = max(a, maxDepth(-1, k));

                was[u] = false;

                was[i] = true;
                int b = maxDepth(-1, u);

                for (int k = 0; k < n; ++k)
                    if (k != i)
                        b = max(b, maxDepth(-1, k));

                was[i] = false;

                ans = max(ans, a * b);
            }*/
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            res = max(res, maxDepth(v, u) + 1);
        }
        if (ok == false)
            return 0;
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j])
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        dfs(v, 0);
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            res = max(res, maxDepth(v, u) + 1);
        }
        if (ok == false)
            return 0;
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j])
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        for (v = 0; v < n; ++v)
            dfs(v, 0);
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        ArrayList<Integer> lst = null;
        if (pred == -1)
            lst = new ArrayList<Integer>();
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            int t = maxDepth(v, u) + 1;
            res = max(res, t);
            if (pred == -1)
                lst.add(t);
        }
        if (ok == false)
            return 0;
        if (pred == -1) {
            Collections.sort(lst);
            if (lst.size() > 1)
                return lst.get(lst.size() - 1) + lst.get(lst.size() - 2);
        }
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j] && g[j].size() == 1)
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        /*
         * for (v = 0; v < n; ++v) if (g[v].size() == 1) dfs(v, 0);
         */
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < g[i].size(); ++j) {
                int u = g[i].get(j);

                was[u] = true;
                int a = maxDepth(-1, i);
                /*
                 * for (int k = 0; k < n; ++k) if (k != u) a = max(a,
                 * maxDepth(-1, k));
                 */
                was[u] = false;

                was[i] = true;
                int b = maxDepth(-1, u);
                /*
                 * for (int k = 0; k < n; ++k) if (k != i) b = max(b,
                 * maxDepth(-1, k));
                 */
                was[i] = false;

                ans = max(ans, a * b);
            }
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            res = max(res, maxDepth(v, u) + 1);
        }
        if (ok == false)
            return 0;
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j])
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        dfs(v, 0);
        for (v = 0; v < n / 10; ++v)
            dfs(v, 0);
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;

    ArrayList<Integer>[] g;

    boolean[] was;

    void fill(int v, int u) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); i++) {
            int next = g[v].get(i);
            if (next == u || was[next])
                continue;
            fill(next, u);
        }
    }

    int dfs(int v, boolean type, int pred) {
        int res = -1000000;
        boolean ok = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (was[v] != was[u])
                continue;
            if (u == pred)
                continue;
            ok = false;
            res = max(res, dfs(u, type, v) + 1);
        }
        if (ok)
            return 0;
        return res;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < n - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        was = new boolean[n];
        int res = -1000000000;
        for (int v = 0; v < n; ++v)
            for (int i = 0; i < g[v].size(); ++i) {
                int u = g[v].get(i);
                Arrays.fill(was, false);
                fill(v, u);
                int a = -100000;
                for (int j = 0; j < n; ++j)
                    if (was[j] == was[v])
                        a = max(a, dfs(j, was[j], -1));
                int b = -100000;
                for (int j = 0; j < n; ++j)
                    if (was[j] == was[u])
                        b = max(b, dfs(j, was[j], -1));
                res = max(res, a * b);
            }
        out.println(res);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int n;
    ArrayList<Integer>[] g;

    boolean[] was;

    int maxDepth(int pred, int v) {
        int res = -100000;
        boolean ok = false;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (u == pred)
                continue;
            if (was[u])
                continue;
            ok = true;
            res = max(res, maxDepth(v, u) + 1);
        }
        if (ok == false)
            return 0;
        return res;
    }

    int ans = -1000000;

    void dfs(int v, int len) {
        was[v] = true;
        for (int i = 0; i < g[v].size(); ++i) {
            int u = g[v].get(i);
            if (!was[u]) {
                dfs(u, len + 1);
            }
        }
        int t = -1000000;
        for (int j = 0; j < n; ++j)
            if (!was[j] && g[j].size() == 1)
                t = max(t, maxDepth(-1, j));
        ans = max(ans, t * len);
        was[v] = false;
    }

    void solve() throws IOException {
        n = ni();
        g = new ArrayList[n];
        for (int i = 0; i < g.length; i++) {
            g[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < g.length - 1; i++) {
            int a = ni() - 1;
            int b = ni() - 1;
            g[a].add(b);
            g[b].add(a);
        }
        int v = -1;
        for (int i = 0; i < g.length; i++) {
            if (g[i].size() == 1) {
                v = i;
                break;
            }
        }
        if (v == -1)
            throw new RuntimeException();
        was = new boolean[n];
        // dfs(v, 0);
        for (v = 0; v < n; ++v)
            if (g[v].size() == 1)
                dfs(v, 0);
        out.println(ans);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	int n;

	ArrayList<Integer>[] g;

	boolean[] was;

	void fill(int v, int u) {
		was[v] = true;
		for (int i = 0; i < g[v].size(); i++) {
			int next = g[v].get(i);
			if (next == u || was[next])
				continue;
			fill(next, u);
		}
	}

	int dfs(int v, boolean type, int pred) {
		int res = -1000000;
		boolean ok = true;
		for (int i = 0; i < g[v].size(); ++i) {
			int u = g[v].get(i);
			if (was[v] != was[u])
				continue;
			if (u == pred)
				continue;
			ok = false;
			res = max(res, dfs(u, type, v) + 1);
		}
		if (ok)
			return 0;
		return res;
	}

	void solve() throws IOException {
		n = ni();
		g = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			g[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < n - 1; i++) {
			int a = ni() - 1;
			int b = ni() - 1;
			g[a].add(b);
			g[b].add(a);
		}
		was = new boolean[n];
		int res = -1000000000;
		for (int v = 0; v < n; ++v)
			for (int i = 0; i < g[v].size(); ++i) {
				int u = g[v].get(i);
				Arrays.fill(was, false);
				fill(v, u);
				int a = -100000;
				for (int j = 0; j < n; ++j)
					if (was[j] == was[v])
						a = max(a, dfs(j, was[j], -1));
				int b = -100000;
				for (int j = 0; j < n; ++j)
					if (was[j] == was[u])
						b = max(b, dfs(j, was[j], -1));
				res = max(res, a * b);
			}
		out.println(res);
	}

	public Solution() throws IOException {
		Locale.setDefault(Locale.US);
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	String ns() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.valueOf(ns());
	}

	long nl() throws IOException {
		return Long.valueOf(ns());
	}

	double nd() throws IOException {
		return Double.valueOf(ns());
	}

	public static void main(String[] args) throws IOException {
		new Solution();
	}
}


import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					try {
						if (new File("input.txt").exists())
							System.setIn(new FileInputStream("input.txt"));
					} catch (SecurityException e) {}
					new Main().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	int vNum;
	int eNum;
	Graph tree;
	Edge[] edges;
	Edge removed;

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		vNum = nextInt();
		eNum = vNum - 1;
		tree = new Graph(vNum, 2 * vNum);
		edges = new Edge [eNum];
		for (int e = 0; e < eNum; e++) {
			int u = nextInt() - 1;
			int v = nextInt() - 1;
			Edge edge = new Edge(u, v);
			edges[e] = edge;
			tree.addEdge(u, edge);
			tree.addEdge(v, edge);
		}

		int ans = 0;
		for (Edge e : edges) {
			removed = e;
			ans = max(ans, maxPathLen(e.u) * maxPathLen(e.v));
		}

		out.println(ans);

		out.close();
	}

	int bestVertex;
	int bestDist;

	int maxPathLen(int v) {
		bestVertex = v;
		bestDist = 0;
		dfs(v, -1, 0);
		bestDist = 0;
		dfs(bestVertex, -1, 0);
		return bestDist;
	}

	void dfs(int v, int p, int d) {
		if (bestDist < d) {
			bestDist = d;
			bestVertex = v;
		}
		for (int i = tree.head[v]; i != 0; i = tree.next[i]) {
			Edge e = tree.edge[i];
			if (e.equals(removed)) continue;
			int nv = e.go(v);
			if (nv != p) dfs(nv, v, d + 1);
		}
	}

	class Graph {
		int[] head;
		int[] next;
		Edge[] edge;
		int cnt = 1;

		Graph(int vNum, int eNum) {
			head = new int [vNum];
			next = new int [eNum + 1];
			edge = new Edge [eNum + 1];
		}

		void addEdge(int u, Edge e) {
			next[cnt] = head[u];
			edge[cnt] = e;
			head[u] = cnt++;
		}
	}

	class Edge {
		int u;
		int v;

		Edge(int u, int v) {
			this.u = min(u, v);
			this.v = max(u, v);
		}

		int go(int from) {
			return from == v ? u : v;
		}

		@Override
		public boolean equals(Object obj) {
			Edge e = (Edge) obj;
			return u == e.u && v == e.v;
		}
	}

	/***************************************************************
	 * Utility
	 **************************************************************/
	long b2mb(long b) {
		return b >> 20;
	}

	void checkMemory() {
		System.err.println(b2mb(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) + "/" + b2mb(Runtime.getRuntime().totalMemory()) + " MB");
	}

	/***************************************************************
	 * Input
	 **************************************************************/
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.StreamTokenizer;
import java.util.LinkedList;

/** Oct 5, 2012 **/

/**
 * @author DOAN Minh Quy
 * @email mquy.doan@gmail.com
 */
public class D14 {
    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        new D14().run();
    }
    LinkedList<Integer>[] neighborList;
    boolean[] visited;
    int distance, position;
    @SuppressWarnings("unchecked")
    void run() throws IOException{
        StreamTokenizer token = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintStream printer = new PrintStream(System.out);
        token.nextToken();
        int numberOfCity = (int)token.nval;
        if ( numberOfCity <= 3 ){
            printer.println("0");
            return;
        }
        LinkedList<Integer> edgeList = new LinkedList<Integer>();
        neighborList = new LinkedList[numberOfCity];
        for(int i = 0 ; i < numberOfCity ; ++i) {
            neighborList[i] = new LinkedList<Integer>();
        }
        for(int i = 0 ; i < numberOfCity - 1; ++i){
            token.nextToken();
            int u = (int)token.nval - 1;
            token.nextToken();
            int v = (int)token.nval - 1;
            neighborList[u].add(v);
            neighborList[v].add(u);
            edgeList.add(u*1000+v);
        }
        visited = new boolean[numberOfCity];
        int result = 0;
        for(int i = 0 ; i < edgeList.size() ; ++i){
            int u = edgeList.get(i) / 1000;
            int v = edgeList.get(i) % 1000;
            visited[v] = true;
            distance = 0; position = u;
            dfsTravel(position, 0);
            dfsTravel(position, 0);
            visited[v] = false;
            int firstDistance = distance;
            visited[u] = true;
            distance = 0 ; position = v;
            dfsTravel(position, 0);
            dfsTravel(position, 0);
            visited[u] = false;
            result = Math.max(result, firstDistance * distance);
        }
        printer.println(result);
    }
    void dfsTravel(int current,int deepth){
        visited[current] = true;
        if ( deepth > distance ){
            distance = deepth;
            position = current;
        }
        for (int next : neighborList[current]) {
            if ( !visited[next] ){
                dfsTravel(next,deepth+1);
            }
        }
        visited[current] = false;
    }
}


// 14.D
import java.util.*;

/*
 * ��� ������ ������������ ����� ���� � ������ ������������ 2 DFS
 */

public class TwoPaths {

	static final int MAXN = 200;
	static final int UNVISITED = -1;

	int n; 				// ���������� ������ � ������
	Set<Integer>[] ls; 	// ������ ���������
	int[] visited;
	int vNotGo; 		// ������ �������, � ������� �� ���� �������� � DFS

	private void dfs (int v, int dist) {
		visited[v] = dist;
		for (int x : ls[v]) {
			if (visited[x] == UNVISITED && x != vNotGo)
				dfs (x, dist + 1);
		}
	}

	// ����� ������������ ����� ���� � �����, ���� �� ������ �������� v
	private int getMaxProfit (int v, int vertNotGo) {
		vNotGo = vertNotGo;
		Arrays.fill(visited, UNVISITED);
		dfs (v, 0);
		int maxi = v; // ������� � ������������ ��������� �� v
		for (int i = 0; i < n; ++i) {
			if (visited[i] > visited[maxi])
				maxi = i;
		}
		Arrays.fill(visited, UNVISITED);
		dfs (maxi, 0);
		int maxLen = 0;
		for (int i = 0; i < n; ++i) {
			maxLen = Math.max(maxLen, visited[i]);
		}
		return maxLen;
	}

	public void run() {
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		assert 2 <= n && n <= MAXN;
		visited = new int[n];
		ls = (Set<Integer>[]) new Set<?>[n];
		for (int i = 0; i < n; ++i) {
			ls[i] = new HashSet<Integer>();
		}
		for (int i = 0; i < n - 1; ++i) {
			int a = in.nextInt();
			int b = in.nextInt();
			ls[a - 1].add(b - 1);
			ls[b - 1].add(a - 1);
		}
		int maxProfit = 0;
		for (int i = 0; i < n; ++i) {
			for (int x : ls[i]) {
				if (x > i) {
					int max1 = getMaxProfit (i, x);
					int max2 = getMaxProfit (x, i);
					maxProfit = Math.max(maxProfit, max1 * max2);
				}
			}
		}
		System.out.println (maxProfit);
	}

	public static void main(String[] args) {
		new TwoPaths().run();
	}
}


import java.io.*;
import java.util.Arrays;
import java.awt.*;

import static java.lang.Math.*;
import static java.lang.Integer.*;
@SuppressWarnings("unused")
public class round14D {

    static int N;
    static boolean [][] graph;
    static boolean [] vis;
    static int [] L;
     public static int dfs(int x) {
            if (vis[x])
                return 0;
            vis[x] = true;
            int max = 0;
            int maxP1 = -2;
            int maxP2 = -2;
            for (int i = 0 ; i < graph[x].length ; ++i) {
                if(!graph[x][i])
                    continue;
                max = Math.max(max, dfs(i));
                if (L[i] > maxP1) {
                    maxP2 = maxP1;
                    maxP1 = L[i];
                } else if (L[i] > maxP2)
                    maxP2 = L[i];
            }
            L[x] = 0;
            for (int i = 0 ; i < graph[x].length ; ++i){
                if(!graph[x][i])
                    continue;
                L[x] = Math.max(L[x], L[i] + 1);
            }
            max = Math.max(max, L[x]);
            return Math.max(max, maxP1 + maxP2 + 2);
        }
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        N = parseInt(br.readLine());
        graph = new boolean [N][N];
        String [] use = null;
        Point [] edges = new Point [N - 1];
        for(int i = 0 ; i < N - 1 ; ++i){
            use = br.readLine().split(" ");
            int f = parseInt(use[0]);
            int t = parseInt(use[1]);
            --f; --t;
            graph[f][t] = graph[t][f] = true;
            edges[i] = new Point(f, t);
        }
        int max = -(int)1e9;
        for(int i = 0 ; i < N - 1 ; ++i){
            Point cur = edges[i];
            int f = cur.x;
            int t = cur.y;
            graph[f][t] = graph[t][f] = false;
            vis = new boolean [N];
            L = new int [N];
            Arrays.fill(L, -5);
            int s1 = dfs(f);
            vis = new boolean [N];
            L = new int [N];
            Arrays.fill(L, -5);
            int s2 = dfs(t);
            max = max(max, s1 * s2);
            graph[f][t] = graph[t][f] = true;
        }
        System.out.println(max);
    }

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int tc;
	cin>>tc;
	while(tc--)
	{
		int a,b,c;
		cin>>a>>b>>c;
		if(a>c)
		{
			cout<<"-1 "<<b<<endl;
			continue;
		}
		else if(a*b<=c)
		{
			cout<<1<<" "<<-1<<endl;
		}
		else{
			cout<<1<<" "<<b<<endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int tc;
	cin>>tc;
	while(tc--)
	{
		ll a,b,c;
		cin>>a>>b>>c;
		if(c<a*b && a>=c)
		cout<<"-1"<<" "<<b<<endl;
		else if(c<a*b && a<c)
		cout<<"1"<<" "<<b<<endl;
		else if(c>=a*b)
		cout<<"1"<<" "<<"-1"<<endl;

	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int tc;
	cin>>tc;
	while(tc--)
	{
		ll a,b,c;
		cin>>a>>b>>c;
		ll x=a*b;
		if(a<c)
		{
			cout<<"1 ";
		}
		else{
			cout<<"-1 ";
		}
		if(x>c)
		{
			cout<<b<<endl;
		}
		else{
			cout<<"-1"<<endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int tc;
	cin>>tc;
	while(tc--)
	{
		int a,b,c;
		cin>>a>>b>>c;
		int x=a*b;
		if(a>c)
		{
			cout<<"-1 ";
		}
		else{
			cout<<"1 ";
		}
		if(x>c)
		{
			cout<<b<<endl;
		}
		else{
			cout<<"-1"<<endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int tc;
	cin>>tc;
	while(tc--)
	{
		int a,b,c;
		cin>>a>>b>>c;
		if(a>=c)
		{
			cout<<"-1 "<<b<<endl;
			continue;
		}
		else if(a*b<=c)
		{
			cout<<1<<" "<<-1<<endl;
		}
		else{
			cout<<1<<" "<<b<<endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int tc;
	cin>>tc;
	while(tc--)
	{
		int a,b,c;
		cin>>a>>b>>c;
		if(a*b>c && a>=c)
		{
			cout<<"-1"<<" "<<b<<endl;
		}
		else if(a*b>c && a<c)
		{
			cout<<1<<" "<<b<<endl;
		}
		else{
			cout<<1<<" "<<-1<<endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll i,j,a,b,c,t;
	cin>>t;
	while(t--){
		ll o1,o2;
		cin>>a>>b>>c;
		if(a>=c){
			o1=-1;
			o2=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a*b==c){
			o2=-1;
			o1=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c){
			o1=1;
			for (i = 1; i <=b; ++i)
			{
				if(a*i>c){
					o2=i;
					break;
				}
			}
			cout<<o1<<" "<<o2<<endl;
		}

	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll i,j,a,b,c,t;
	cin>>t;
	while(t--){
		ll o1,o2;
		cin>>a>>b>>c;
		if(a>c){
			o1=-1;
			o2=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a*b==c){
			o2=-1;
			o1=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c && a*b<c){
			o1=1;
			o2=-1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c&&a*b>c){
			o1=1;
			for (int i = 0; i <= b; ++i)
			{
				if(a*i>c){
					o2=i;
					break;
				}
			}
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a==c){
			cout<<-1<<" "<<2;
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll i,j,a,b,c,t;
	cin>>t;
	while(t--){
		ll o1,o2;
		cin>>a>>b>>c;
		if(a>c){
			o1=-1;
			o2=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a*b==c){
			o2=-1;
			o1=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c && a*b<c){
			o1=1;
			o2=-1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c&&a*b>c){
			o1=1;
			cout<<o1<<" "<<b<<endl;
		}
		else if(a==c){
			cout<<-1<<" "<<2<<endl;
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll i,j,a,b,c,t;
	cin>>t;
	while(t--){
		ll o1,o2;
		cin>>a>>b>>c;
		if(a>c){
			o1=-1;
			o2=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a*b==c){
			o2=-1;
			o1=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c && a*b<c){
			o1=1;
			o2=-1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c&&a*b>c){
			o1=1;
			for (int i = 0; i <= b; ++i)
			{
				if(a*i>c){
					o2=i;
					break;
				}
			}
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a==c){
			cout<<-1<<" "<<2<<endl;
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll i,j,a,b,c,t;
	cin>>t;
	while(t--){
		ll o1,o2;
		cin>>a>>b>>c;
		if(a>c){
			o1=-1;
			o2=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a*b==c){
			o2=-1;
			o1=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c && a*b<c){
			o1=1;
			o2=-1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c&&a*b>c){
			o1=1;
			cout<<o1<<" "<<b+1<<endl;
		}
		else if(a==c){
			cout<<-1<<" "<<2<<endl;
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll i,j,a,b,c,t;
	cin>>t;
	while(t--){
		ll o1,o2;
		cin>>a>>b>>c;
		if(a>c){
			o1=-1;
			o2=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a*b==c){
			o2=-1;
			o1=1;
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a<c){
			o1=1;
			for (i = 1; i <=b; ++i)
			{
				if(a*i>c){
					o2=i;
					break;
				}
			}
			cout<<o1<<" "<<o2<<endl;
		}
		else if(a==c){
			cout<<-1<<" "<<2;
		}
	}
	return 0;
}


//FIRST THINK THEN CODE.

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}

ll powM(ll a,ll b,ll m )
{
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll poww(ll a,ll b)
{

  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;

}

const ll N=1e6+5;

ll sp[N];

void sieve(){
  for(int i=1;i<N;i++)sp[i]=i;

  for(int i=2;i*i<N;i++){
    if(sp[i]==i){
    for(int j=i*i;j<N;j+=i){
      sp[j]=i;
    }
  }
 }
}

int main()
{

  IOS;

sieve();

ll  t;cin>>t;

while(t--){

ll a,b,c;
cin>>a>>b>>c;
ll ans1,ans2;
if(a*b<c)ans1=b;
else if(a*b==c){
  ans1=1;
}
else{
  if(c>a){
ll temp1=(c-a-1)/(a*b-c);
ans1=1;
  }
  else ans1=-1;
}

if(a*b>c)ans2=b;

else if(a*b==c)ans2=-1;

else{
 if(c>=a)ans2=-1;
   else{

    ll temp2=ceil((a-c+1)/(c-a*b));
    temp2=max(temp2,0LL);
    ans2=1;
}
}
cout<<ans1<<" "<<ans2<<endl;
}

return 0;

}


//FIRST THINK THEN CODE.

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}

ll powM(ll a,ll b,ll m )
{
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll poww(ll a,ll b)
{

  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;

}

const ll N=1e6+5;

ll sp[N];

void sieve(){
  for(int i=1;i<N;i++)sp[i]=i;

  for(int i=2;i*i<N;i++){
    if(sp[i]==i){
    for(int j=i*i;j<N;j+=i){
      sp[j]=i;
    }
  }
 }
}

int main()
{

  IOS;

sieve();

ll  t;cin>>t;

while(t--){

ll a,b,c;
cin>>a>>b>>c;
ll ans1,ans2;
if(a*b<c)ans1=b;
else if(a*b==c){
  ans1=b+1;
}
else{
  if(c>a){
ll temp1=(c-a-1)/(a*b-c);
ans1=1;
  }
  else ans1=-1;
}

if(a*b>c)ans2=b;

else if(a*b==c)ans2=-1;

else{
 if(c>=a)ans2=-1;
   else{

    ll temp2=ceil((a-c+1)/(c-a*b));
    temp2=max(temp2,0LL);
    ans2=b*temp2+1;
}
}
cout<<ans1<<" "<<ans2<<endl;
}

return 0;

}


//FIRST THINK THEN CODE.

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}

ll powM(ll a,ll b,ll m )
{
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll poww(ll a,ll b)
{

  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;

}

const ll N=1e6+5;

ll sp[N];

void sieve(){
  for(int i=1;i<N;i++)sp[i]=i;

  for(int i=2;i*i<N;i++){
    if(sp[i]==i){
    for(int j=i*i;j<N;j+=i){
      sp[j]=i;
    }
  }
 }
}

int main()
{

  IOS;

sieve();

ll  t;cin>>t;

while(t--){

ll a,b,c;
cin>>a>>b>>c;
ll ans1,ans2;
if(a*b<c)ans1=b;
else if(a*b==c){
  ans1=b+1;
}
else{
  if(c>a){
ll temp1=(c-a)/(a*b-c);
ans1=b*temp1+1;
  }
  else ans1=-1;
}

if(a*b>c)ans2=b;

else if(a*b==c)ans2=-1;

else{

    ll temp2=ceil((a-c)/(c-a*b));
    temp2=max(temp2,0LL);
    ans2=b*temp2+1;
}
cout<<ans1<<" "<<ans2<<endl;
}

return 0;

}


//FIRST THINK THEN CODE.

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}

ll powM(ll a,ll b,ll m )
{
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll poww(ll a,ll b)
{

  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;

}

const ll N=1e6+5;

ll sp[N];

void sieve(){
  for(int i=1;i<N;i++)sp[i]=i;

  for(int i=2;i*i<N;i++){
    if(sp[i]==i){
    for(int j=i*i;j<N;j+=i){
      sp[j]=i;
    }
  }
 }
}

int main()
{

  IOS;

sieve();

ll  t;cin>>t;

while(t--){

ll a,b,c;
cin>>a>>b>>c;
ll ans1,ans2;
if(a*b<c)ans1=b;
else if(a*b==c){
  ans1=b+1;
}
else{
  if(c>a){
ll temp1=(c-a-1)/(a*b-c);
ans1=b*temp1+1;
  }
  else ans1=-1;
}

if(a*b>c)ans2=b;

else if(a*b==c)ans2=-1;

else{
 if(c>=a)ans2=-1;
   else{

    ll temp2=ceil((a-c+1)/(c-a*b));
    temp2=max(temp2,0LL);
    ans2=b*temp2+1;
}
}
cout<<ans1<<" "<<ans2<<endl;
}

return 0;

}


//FIRST THINK THEN CODE.

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}

ll powM(ll a,ll b,ll m )
{
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll poww(ll a,ll b)
{

  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;

}

const ll N=1e6+5;

ll sp[N];

void sieve(){
  for(int i=1;i<N;i++)sp[i]=i;

  for(int i=2;i*i<N;i++){
    if(sp[i]==i){
    for(int j=i*i;j<N;j+=i){
      sp[j]=i;
    }
  }
 }
}

int main()
{

  IOS;

sieve();

ll  t;cin>>t;

while(t--){

ll a,b,c;
cin>>a>>b>>c;
ll ans1,ans2;
if(a*b<c)ans1=b;
else if(a*b==c){
  ans1=b+1;
}
else{
  if(c>a){
ll temp1=(c-a-1)/(a*b-c);
ans1=b*temp1+1;
  }
  else ans1=-1;
}

if(a*b>c)ans2=b;

else if(a*b==c)ans2=-1;

else{

    ll temp2=ceil((a-c)/(c-a*b));
    temp2=max(temp2,0LL);
    ans2=b*temp2+1;
}
cout<<ans1<<" "<<ans2<<endl;
}

return 0;

}


//FIRST THINK THEN CODE.

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}

ll powM(ll a,ll b,ll m )
{
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll poww(ll a,ll b)
{

  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;

}

const ll N=1e6+5;

ll sp[N];

void sieve(){
  for(int i=1;i<N;i++)sp[i]=i;

  for(int i=2;i*i<N;i++){
    if(sp[i]==i){
    for(int j=i*i;j<N;j+=i){
      sp[j]=i;
    }
  }
 }
}

int main()
{

  IOS;

sieve();

ll  t;cin>>t;

while(t--){

ll a,b,c;
cin>>a>>b>>c;
ll ans1,ans2;
if(a*b<c)ans1=b;
else if(a*b==c){
  ans1=b+1;
}
else{
  if(c>a){
ll temp1=(c-a-1)/(a*b-c);
ans1=b*temp1+1;
  }
  else ans1=-1;
}

if(a*b>c)ans2=b;

else if(a*b==c)ans2=-1;

else{

    ll temp2=ceil((a-c+1)/(c-a*b));
    temp2=max(temp2,0LL);
    ans2=b*temp2+1;
}
cout<<ans1<<" "<<ans2<<endl;
}

return 0;

}


//FIRST THINK THEN CODE.

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}

ll powM(ll a,ll b,ll m )
{
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll poww(ll a,ll b)
{

  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;

}

const ll N=1e6+5;

ll sp[N];

void sieve(){
  for(int i=1;i<N;i++)sp[i]=i;

  for(int i=2;i*i<N;i++){
    if(sp[i]==i){
    for(int j=i*i;j<N;j+=i){
      sp[j]=i;
    }
  }
 }
}

int main()
{

  IOS;

sieve();

ll  t;cin>>t;

while(t--){

ll a,b,c;
cin>>a>>b>>c;
ll ans1,ans2;
if(a*b<c)ans1=b;
else if(a*b==c){
  ans1=b+1;
}
else{
  if(c>a){
ll temp1=(c-a-1)/(a*b-c);
ans1=1;
  }
  else ans1=-1;
}

if(a*b>c)ans2=b;

else if(a*b==c)ans2=-1;

else{
 if(c>=a)ans2=-1;
   else{

    ll temp2=ceil((a-c+1)/(c-a*b));
    temp2=max(temp2,0LL);
    ans2=1;
}
}
cout<<ans1<<" "<<ans2<<endl;
}

return 0;

}


#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
int main(void) {
    int n;
    cin>>n;
    for(int i =0;i<n;i++){
        long long int a,b,c,x=0;
        cin>>a>>b>>c;
        int x1=-1,x2=-1;
        while(x <= 100000000){
            if(x1!=-1&&x2!=-1) break;
            long long int pa = a*x;
            long long int pb = c*ceil(double(x)/double(b));
            if(pa < pb && x1==-1) x1=x;
            if (pb < pa && x2 == -1){ x2 = x; break;}
            x++;
        }
        cout<<x1<<' '<<x2<<endl;
    }
return 0;
}


#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
int main(void) {
    int n;
    cin>>n;
    for(int i =0;i<n;i++){
        long long int a,b,c,x=0;
        cin>>a>>b>>c;
        int x1=-1,x2=-1;
        while(x <= 1000000000){
            if(x1!=-1&&x2!=-1) break;
            long long int pa = a*x;
            long long int j;
            if(x%b==0) j=x/b;
            else j=x/b+1;
            long long int pb = c*j;
            if(pa < pb && x1==-1) x1=x;
            if (pb < pa && x2 == -1){ x2 = x; break;}
            if(x1!=-1) x+=b;
            else x++;
        }
        cout<<x1<<' '<<x2<<endl;
    }
return 0;
}


#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
int main(void) {
    int n;
    cin>>n;
    for(int i =0;i<n;i++){
        long long int a,b,c,x=0;
        cin>>a>>b>>c;
        int x1=-1,x2=-1;
        while(x <= 100000000){
            if(x1!=-1&&x2!=-1) break;
            long long int pa = a*x;
            long long int pb = c*ceil(double(x)/double(b));
            if(pa < pb && x1==-1) x1=x;
            if (pb < pa && x2 == -1){ x2 = x; break;}
            x+=b;
        }
        cout<<x1<<' '<<x2<<endl;
    }
return 0;
}


#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
int main(void) {
    int n;
    cin>>n;
    for(int i =0;i<n;i++){
        long long int a,b,c,x=0;
        cin>>a>>b>>c;
        int x1=-1,x2=-1;
        while(x <= 100000000){
            if(x1!=-1&&x2!=-1) break;
            long long int pa = a*x;
            long long int pb = c*ceil(double(x)/double(b));
            if(pa < pb && x1==-1) x1=x;
            if (pb < pa && x2 == -1){ x2 = x; break;}
            if(x1!=-1) x+=b;
            else x++;
        }
        cout<<x1<<' '<<x2<<endl;
    }
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  char s[1005];
  for (int i = 0; i < n; i++) {
    cin >> s;
    int t = 0, res = 0, ans = 0;
    int dp[1005] = {0};
    char pre = s[0];
    int d;
    if (pre == '+')
      d = 1;
    else
      d = -1;
    int x = 0;
    int l = strlen(s);
    for (int j = 0; j < l; j++) {
      if (s[j] == pre)
        dp[x]++;
      else
        dp[++x]++;
      pre = s[j];
      if (s[j] == '+')
        ans++;
      else if (s[j] == '-')
        ans--;
    }
    res = 0;
    for (int j = 0;; j++) {
      int jj = j;
      int dd = d;
      int f = 0;
      for (int x2 = 0; x2 <= x; x2++) {
        jj += dp[x2] * dd;
        dd *= -1;
        res += abs(dp[x2]);
        if (jj < 0) {
          res += jj;
          res++;
          f = 1;
          break;
        }
      }
      if (f == 0) break;
    }
    cout << res << endl;
  }
  return 0;
}


#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
int main(void) {
    int n;
    cin>>n;
    for(int i =0;i<n;i++){
        long long int a,b,c,x=0;
        cin>>a>>b>>c;
        int x1=-1,x2=-1;
        long long int j;
        if(x%b==0) j=x/b;
        else j=x/b+1;
        x1=floor(j*c/a);
        x2=ceil(j*c/a);
        if(x1>1E9) x1=-1;
        if(x2>1E9) x2=-1;
        cout<<x1<<' '<<x2<<endl;
    }
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  while (n--) {
    long long int a, b, c;
    cin>>a>>b>>c;
    if(a<c) cout<<1<<" ";
    else cout<<-1<<" "
    if(a*b>c)  cout<<b<<endl;
    else cout<<-1<<endl;
  }
}


#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin>>n;
  while (n--) {
    long long int a, b, c;
    cin>>a>>b>>c;
    if(a<c) cout<<1<<" ";
    else cout<<-1<<" ";

    if(a*b>c)  cout<<b<<endl;
    else cout<<-1<<endl;
  }
}


#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
int main(void) {
    int n;
    cin>>n;
    for(int i =0;i<n;i++){
        long long int a,b,c,x=0;
        cin>>a>>b>>c;
        int x1=-1,x2=-1;
        while(x <= 100000000){
            if(x1!=-1&&x2!=-1) break;
            long long int pa = a*x;
            long long int j;
            if(x%b==0) j=x/b;
            else j=x/b+1;
            long long int pb = c*j;
            if(pa < pb && x1==-1) x1=x;
            if (pb < pa && x2 == -1){ x2 = x; break;}
            if(x1!=-1) x+=b;
            else x++;
        }
        cout<<x1<<' '<<x2<<endl;
    }
return 0;
}


#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
int main(void) {
    int n;
    cin>>n;
    for(int i =0;i<n;i++){
        long long int a,b,c,x=0;
        cin>>a>>b>>c;
        int x1=-1,x2=-1;
        while(x <= 100000000){
            if(x1!=-1&&x2!=-1) break;
            long long int pa = a*x;
            long long int pb = c*ceil(double(x)/double(b));
            if(pa < pb && x1==-1) x1=x;
            if (pb < pa && x2 == -1) x2 = x;
            x++;
        }
        cout<<x1<<' '<<x2<<endl;
    }
return 0;
}


#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    double a,b,c;
	    cin>>a>>b>>c;
	    double x = c/b;
	    if(a==x && a==b)
	    {
	        cout<<"-1"<<" ";
	    }
	    else if(a==x && b>a)
	    {
	        cout<<(long int)a<<" ";
	    }
	    else if(a>x && c>a)
	    {
	        cout<<"1"<<" ";
	    }
	    else
	    cout<<"-1"<<" ";
	    if(x<a)
	    {
	        cout<<(long int)b<<" ";
	    }
	    else
	    cout<<"-1";
	    cout<<endl;

	}
}


#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    double a,b,c;
	    cin>>a>>b>>c;
	    double x = c/b;

	     if(a==x && b>a)
	    {
	        cout<<(long int)a<<" ";
	    }
	    else if(a>x && c>a)
	    {
	        cout<<"1"<<" ";
	    }
	    else if(a<x)
	    cout<<"1"<<" ";
	    else
	    cout<<"-1"<<" ";
	    if(x<a)
	    {
	        cout<<(long int)b<<" ";
	    }w
	    else
	    cout<<"-1";
	    cout<<endl;

	}
}


#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    double a,b,c;
	    cin>>a>>b>>c;
	    double x = c/b;

	     if(a==x && b>a)
	    {
	        cout<<(long int)a<<" ";
	    }
	    else if(a>x && c>a)
	    {
	        cout<<"1"<<" ";
	    }
	    else if(a<x)
	    cout<<"1"<<" ";
	    else
	    cout<<"-1"<<" ";
	    if(x<a)
	    {
	        cout<<(long int)b<<" ";
	    }
	    else
	    cout<<"-1";
	    cout<<endl;

	}
}


#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    double a,b,c;
	    cin>>a>>b>>c;
	    double x = c/b;
	    if(a==x && a==b)
	    {
	        cout<<"-1"<<" ";
	    }
	    else if(a==x && b>a)
	    {
	        cout<<(long int)a*2<<" ";
	    }
	    else if(a>x && (x*a)>a)
	    {
	        cout<<"1"<<" ";
	    }
	    else
	    cout<<"-1"<<" ";
	    if(x<a)
	    {
	        cout<<(long int)b<<" ";
	    }
	    else
	    cout<<"-1";
	    cout<<endl;

	}
}


#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    double a,b,c;
	    cin>>a>>b>>c;
	    double x = c/b;
	    if(a==x && a==b)
	    {
	        cout<<"-1"<<" ";
	    }
	    else if(a==x && b>a)
	    {
	        cout<<(long int)a<<" ";
	    }
	    else if(a>x && c>a)
	    {
	        cout<<"1"<<" ";
	    }
	    else if(a<x)
	    cout<<"1"<<" ";
	    else
	    cout<<"-1"<<" ";
	    if(x<a)
	    {
	        cout<<(long int)b<<" ";
	    }
	    else
	    cout<<"-1";
	    cout<<endl;

	}
}


#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    double a,b,c;
	    cin>>a>>b>>c;
	    double x = c/b;

	    if(a==x && (b>1))
	    {
	        cout<<"1"<<" ";
	    }
	    else if(a>x && c>a)
	    {
	        cout<<"1"<<" ";
	    }
	    else if(a<x)
	    cout<<"1"<<" ";
	    else
	    cout<<"-1"<<" ";
	    if(x<a)
	    {
	        cout<<(long int)b<<" ";
	    }
	    else
	    cout<<"-1";
	    cout<<endl;

	}
}


#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    double a,b,c;
	    cin>>a>>b>>c;
	    double x = c/b;
	    if(a==x && a==b)
	    {
	        cout<<"-1"<<" ";
	    }
	    else if(a==x && b>a)
	    {
	        cout<<(long int)a*2<<" ";
	    }
	    else if(a>x && a<=b)
	    {
	        cout<<"1"<<" ";
	    }
	    else
	    cout<<"-1"<<" ";
	    if(x<a)
	    {
	        cout<<(long int)b<<" ";
	    }
	    else
	    cout<<"-1";
	    cout<<endl;

	}
}


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

   tc(t)
   {
     ll a,b,c;
     cin>>a>>b>>c;

    ll ans1 = a*b;

    if(ans1> c)
    {
        cout<<-1<<" "<<b<<endl;
    }

   else if(ans1 ==c)
    {
        cout<<b*2-1<<" "<<-1<<endl;
    }

    else if(ans1 < c)
    {
        cout<<1<<" "<<-1<<endl;
    }

   }

    return 0;
}


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

   tc(t)
   {
     ll a,b,c;
     cin>>a>>b>>c;

    ll ans1 = a*b;

    if(a==b && a<c)
    {
        cout<<1<<" "<<b<<endl;
    }

    else if(b==c && a<b)
    {
        cout<<1<<" "<<b<<endl;
    }

    else if(ans1 > c)
    {
        cout<<-1<<" "<<b<<endl;
    }

   else if(ans1 == c)
    {

        if(b==1000000000)
        {
            cout<<1<<" "<<-1<<endl;
        }

       else
       {
          cout<<b*2-1<<" "<<-1<<endl;
       }

    }

    else if(ans1 < c)
    {
        cout<<5<<" "<<-1<<endl;
    }

   }

    return 0;
}


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

    tc(t)
    {
        ll a, b, c;

        cin >> a >> b >> c;

        float ans = c/b;

        if(a > ans)
        {
            int cnt1=-1; int cnt2=-1;

            if(a<c)
            {
                cnt1=1;
            }
            if(c < a*b)
            {
                cnt2=b;
            }

            cout<<cnt1<<" "<<cnt2<<endl;
        }

        else
        {
            cout<<1<<" "<<-1<<endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

   tc(t)
   {
     ll a,b,c;
     cin>>a>>b>>c;

    ll ans1 = a*b;

    if(a==b && a<c)
    {
        cout<<1<<" "<<b-1<<endl;
    }

    else if(ans1> c)
    {
        cout<<-1<<" "<<b-1<<endl;
    }

   else if(ans1 ==c)
    {

        if(b==1000000000)
        {
            cout<<1<<" "<<-1<<endl;
        }

       else
       {
          cout<<b*2-1<<" "<<-1<<endl;
       }

    }

    else if(ans1 < c)
    {
        cout<<5<<" "<<-1<<endl;
    }

   }

    return 0;
}


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

   tc(t)
   {
     ll a,b,c;
     cin>>a>>b>>c;

    ll ans1 = a*b;

    if(a==b && a<c)
    {
        cout<<1<<" "<<b<<endl;
    }

    else if(ans1> c)
    {
        cout<<-1<<" "<<b<<endl;
    }

   else if(ans1 ==c)
    {

        if(b==1000000000)
        {
            cout<<1<<" "<<-1<<endl;
        }

       else
       {
          cout<<b*2-1<<" "<<-1<<endl;
       }

    }

    else if(ans1 < c)
    {
        cout<<5<<" "<<-1<<endl;
    }

   }

    return 0;
}


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

   tc(t)
   {
     ll a,b,c;
     cin>>a>>b>>c;

    ll ans1 = a*b;

    if(a==b && a<c)
    {
        cout<<1<<" "<<b<<endl;
    }

    else if(ans1> c)
    {
        cout<<-1<<" "<<b<<endl;
    }

   else if(ans1 ==c)
    {
        cout<<b*2-1<<" "<<-1<<endl;
    }

    else if(ans1 < c)
    {
        cout<<1<<" "<<-1<<endl;
    }

   }

    return 0;
}


#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

    tc(t)
    {
        ll a, b, c;

        cin >> a >> b >> c;

        ll ans1 = a * b;

        ll ans2 = a / c+1;

        if (b <= a && a<c)
        {
            cout << 1 << " " << b*ans2 << endl;
        }
        else if(a==b && a==c)
        {
            cout<<-1<<" "<<a<<endl;
        }

        else if (ans1 > c)
        {

            cout << -1 << " " << (b)*ans2 << endl;
        }

        else if (ans1 == c)
        {
            cout << b * 2 - 1 << " " << -1 << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
const ll mod = 1000000007;
const ll AM = 2e5 + 5;
using namespace std;
int main()
{
  Boost;
  ll t;
  cin >> t;
  while (t--)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a>=c){
      cout << -1 << " ";
    }
    else{
      cout <<1<<" ";
    }
    if(a>=c){
      cout << 2*b << endl;
    }
    else if(a*b==c)
      cout << -1 << endl;
    else if(a<float(b/float(c)))
      cout << -1 << endl;
    else{
      a*=b;
      while (a < c){
        b *= 2;
        a *= b;
      }
      cout << b << endl;
    }
  }
}


#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
const ll mod = 1000000007;
const ll AM = 2e5 + 5;
using namespace std;
int main()
{
  Boost;
  ll t;
  cin >> t;
  while (t--)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a>=c){
      cout << -1 << " ";
    }
    else{
      cout <<1<<" ";
    }
    if(a>=c){
      cout << 2*b << endl;
    }
    else if(a*b==c)
      cout << -1 << endl;
    // else if(a<float(b/float(c)))
    //   cout << -1 << endl;
    else{
      a*=b;
      while (a < c){
        b *= 2;
        a *= b;
      }
      cout << b << endl;
    }
  }
}


#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
const ll mod = 1000000007;
const ll AM = 2e5 + 5;
using namespace std;
int main()
{
  Boost;
  ll t;
  cin >> t;
  while (t--)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a>=c){
      cout << -1 << " ";
    }
    else{
      cout <<1<<" ";
    }
    if(a>=c){
      cout << b << endl;
    }
    else if(a*b==c)
      cout << -1 << endl;
    else{
      a*=b;
      while (a < c){
        b *= 2;
        a *= b;
      }
      cout << b << endl;
    }
  }
}


#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
const ll mod = 1000000007;
const ll AM = 2e5 + 5;
using namespace std;
int main()
{
  Boost;
  ll t;
  cin >> t;
  while (t--)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a >= c)
    {
      cout << -1 << " ";
    }
    else
    {
      cout << 1 << " ";
    }
    if (a >= c)
    {
      cout << b << endl;
    }
    else if (a * b == c)
      cout << -1 << endl;
    else if(a<float(c)/float(b))
      cout << -1 << endl;
    else
    {
      a *= b;
      while (a < c)
      {
        b *= 2;
        a *= b;
      }
      cout << b << endl;
    }
  }
}


#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
const ll mod = 1000000007;
const ll AM = 2e5 + 5;
using namespace std;
int main()
{
  Boost;
  ll t;
  cin >> t;
  while (t--)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a>=c){
      cout << -1 << " ";
    }
    else{
      cout <<1<<" ";
    }
    if(a>c){
      cout << 2*b << endl;
    }
    else if(a*b==c)
      cout << -1 << endl;
    else{
      a*=b;
      while (a < c){
        b *= 2;
        a *= b;
      }
      cout << b << endl;
    }
  }
}


#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
const ll mod = 1000000007;
const ll AM = 2e5 + 5;
using namespace std;
int main()
{
  Boost;
  ll t;
  cin >> t;
  while (t--)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a>=c){
      cout << -1 << " ";
    }
    else{
      cout <<1<<" ";
    }
    if(a>=c){
      cout << 2*b << endl;
    }
    else if(a*b==c)
      cout << -1 << endl;
    else{
      a*=b;
      while (a < c){
        b *= 2;
        a *= b;
      }
      cout << b << endl;
    }
  }
}


#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
const ll mod = 1000000007;
const ll AM = 2e5 + 5;
using namespace std;
int main()
{
  Boost;
  ll t;
  cin >> t;
  while (t--)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a>=c){
      cout << -1 << " ";
    }
    else{
      cout <<1<<" ";
    }
    if(a>c){
      cout << b << endl;
    }
    else if(a*b==c)
      cout << -1 << endl;
    else{
      a*=b;
      while (a < c){
        b *= 2;
        a *= b;
      }
      cout << b << endl;
    }
  }
}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        if(a < c) c1 = 1;
        if(c < (b+1)*a) c2 = b;

        cout<<c1<<" "<<c2;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        if(a < c) c1 = 1;
        if(c < b*a) c2 = b;

        cout<<c1<<" "<<c2;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        if(a < c) c1 = 1;
        if(c < b*a) c2 = b;

        cout<<c1<<" "<<c2<<endl;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        for(ll i=1; i<= b*a*c; i++){
            if(c1 !=-1) break;

            ll x;
                if(i<b) x = 1;
                else if(i%b == 0) x = i/b;
                else x = i/b+1;

            if(c1 == -1 && a*i < x*c) c1 = i;
        }

        for(ll i=b; i<b*a*c; i++){
            if(c2 != -1) break;
            if(a*i > i*c) c2 = i;
        }

        cout<<c1<<" "<<c2;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        for(ll i=1; i<= b*a*c; i++){
            if(c1 !=-1) break;

            ll x;
                if(i<b) x = 1;
                else if(i%b == 0) x = i/b;
                else x = i/b+1;

            if(c1 == -1 && a*i < x*c) c1 = i;
        }

        for(ll i=b; i<b+a+c; i++){
            if(c2 != -1) break;
            if(a*i > i*c) c2 = i;
        }

        cout<<c1<<" "<<c2;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        for(ll i=1; i<= b+a+c; i++){
            if(c1 !=-1) break;

            ll x;
                if(i<b) x = 1;
                else if(i%b == 0) x = i/b;
                else x = i/b+1;

            if(c1 == -1 && a*i < x*c) c1 = i;
        }

        for(ll i=b; i<b+a+c; i+=b){
            if(c2 != -1) break;
            if(a*i > i*c) c2 = i;
        }

        cout<<c1<<" "<<c2;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        for(ll i=1; i<= b; i++){
            if(c1 !=-1) break;

            ll x;
                if(i<b) x = 1;
                else if(i%b == 0) x = i/b;
                else x = i/b+1;

            if(c1 == -1 && a*i < x*c) c1 = i;
        }

        for(ll i=b; i<5*b; i+=b){
            if(c2 != -1) break;
            if(a*i > i*c) c2 = i;
        }

        cout<<c1<<" "<<c2;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
#define vi vector<ll>
#define rep(n) for(ll i =0; i<n; i++)
#define reps(x,n) for(ll i = x; i<n; i++)
#define sorta(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.rbegin(), v.rend())

int main() {
   ll t;
   cin>>t;

    while(t--){
        ll a,b,c;
        cin>>a>>b>>c;
        ll c1 =-1,c2=-1;
        while ()
        {
            /* code */
        }

            if(c1 !=-1) break;

            ll x;
                if(i<b) x = 1;
                else if(i%b == 0) x = i/b;
                else x = i/b+1;

            if(c1 == -1 && a*i < x*c) c1 = i;
        }

        for(ll i=b; i<b+a+c; i+=b){
            if(c2 != -1) break;
            if(a*i > i*c) c2 = i;
        }

        cout<<c1<<" "<<c2;
    }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,c;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        if(a>=c)
            cout<<"-1"<<" ";
        else
            cout<<"1"<<" ";
        if(a*b<c)
            cout<<b<<endl;
        else
            cout<<"-1"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,c;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        if(a>=c)
            cout<<"-1"<<" ";
        else
            cout<<"1"<<" ";
        if(a*b<=c)
            cout<<"-1"<<endl;
        else
            cout<<b<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int t;
    ll a,b,c;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        if(a>=c)
            cout<<"-1"<<" ";
        else
            cout<<"1"<<" ";
        if(a*b<=c)
            cout<<-1<<endl;
        else
            cout<<b<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,c;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        if(a>=c)
            cout<<"-1"<<" ";
        else
            cout<<"1"<<" ";
        if(a*b>c)
            cout<<b<<endl;
        else
            cout<<"-1"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,c;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        if(a>=c)
            cout<<"-1"<<" ";
        else
            cout<<"1"<<" ";
        if(a*b<c)
            cout<<"-1"<<endl;
        else
            cout<<b<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,c;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        if(a>c)
            cout<<"-1"<<" ";
        else
            cout<<"1"<<" ";
        if(a*b<=c)
            cout<<"-1"<<endl;
        else
            cout<<b<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long int a,b,c;
        cin>>a>>b>>c;
        if(a>=c)
        {
            cout<<"-1"<<" ";
        }
        else{
            cout<<"1"<<" ";
        }
       long long int r=a*b;
        if(r<=c)
        {
            cout<<"-1";
        }
        else{
            cout<<b;
        }
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(a>=c)
        {
            cout<<"-1"<<" ";
        }
        else{
            cout<<"1"<<" ";
        }
       long long int r=a*b;
        if(r<=c)
        {
            cout<<"1";
        }
        else{
            cout<<"2";
        }
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        int flag=0;
        int flag1=0;
        int r=0,z=0;
        for(int i=1;i<=b;i++)
        {
            if(a*i<c)
            {
                flag=1;
                z=i;
            }
            if(c<a*i)
            {
                flag1=1;
                r=i;
            }
            if(flag==1 && flag1==1)
            {
                break;
            }
        }
        if(flag==1 && flag1==1)
        {
            cout<<z<<" "<<r<<endl;
        }
        else if(flag1==1)
        {
            cout<<"-1"<<" "<<r<<endl;
        }
        else{
            cout<<z<<" "<<"-1"<<endl;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(a>=c)
        {
            cout<<"-1"<<" ";
        }
        else{
            cout<<"1"<<" ";
        }
        int r=a*b;
        if(r<=c)
        {
            cout<<"1";
        }
        else{
            cout<<"2";
        }
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(a>=c)
        {
            cout<<"-1"<<" ";
        }
        else{
            cout<<"1"<<" ";
        }
       long long  int r=a*b;
        if(r<=c)
        {
            cout<<"-1";
        }
        else{
            cout<<"2";
        }
        cout<<endl;
    }

    return 0;
}