codeparrot/codecomplex huggingface dataset:
// Problem: 235_A. LCM Challenge
// Time complexity: constant

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {
	public static void main(String[] args) throws IOException {
		InputReader sc = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = sc.nextInt();

		if(n < 3)
			out.println(n);
		else
		{
			if((n & 1) == 1)
				out.println(lcm(n, lcm(n - 1, n - 2)));
			else
				out.println(Math.max(lcm(n - 1, lcm(n - 2, n - 3)), lcm(n, lcm(n - 1, n - 3))));
		}
		out.flush();
		out.close();
	}

	static long gcd(long a, long b) 
	{ 
		while(b != 0)
		{
			a = a%b;
			b ^= a;
			a ^= b;
			b ^= a;
		}
		return a;

	}

	static long lcm(long a, long b) { return a / gcd(a,b) * b; }
}



class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

}
// Problem: 235_A. LCM Challenge
// Time complexity: constant
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author BSRK Aditya (bsrkaditya@gmail.com)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        long n = in.nextLong();

        if(n == 1) out.println("1");
        else if(n == 2) out.println("2");
        else if(n%2 == 1) out.println(n*(n-1)*(n-2));
        else if(n%6 == 0) out.println((n-1)*(n-2)*(n-3));
        else out.println(n*(n-1)*(n-3));
	}
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.*;
import java.util.StringTokenizer;

public class A267 {

    static  public  long _solve(long a,long b){
        long result = -1;
        while(a!=0 && b!=0){
            if(a>b){
                result +=(a/b);
                a = a%b;
            }
            else{
                result +=(b/a);
                b = b%a;
            }
        }
        return result+1;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        long a,b;
        while(t-- > 0){
            a = in.nextLong();
            b = in.nextLong();
            System.out.println(_solve(a,b));
        }
    }


    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public String next() {
            while (st == null || !st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Coder{
    
    static class FastScanner{
        BufferedReader s;
        StringTokenizer st;
        
        public FastScanner(){
            st = new StringTokenizer("");
            s = new BufferedReader(new InputStreamReader(System.in));
        }
        
        public int nextInt() throws IOException{
            if(st.hasMoreTokens())
                return Integer.parseInt(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextInt();
            }
        }
    }
    
    
    public static void main(String[] args) throws IOException{
        FastScanner s = new FastScanner();
        PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));
        int test = s.nextInt(); int cnt=0;
        while(test-->0){
            int a = s.nextInt();
            int b = s.nextInt();
            cnt=0;
            while(a!=0 && b!=0){
                int max = Math.max(a, b);
                if(max == b){
                    int divi = b/a;
                    b -= divi*a;
                    cnt+=divi;
                }else{
                    int divi = a/b;
                    a -= divi*b;
                    cnt+=divi;
                }
        //      System.out.println(a+" "+b);
            }
            ww.println(cnt);
        }
        ww.close();
    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.*;
public class Solution{

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int pairs = in.nextInt();
        while (pairs > 0){
            in.nextLine();
            int a = in.nextInt();
            int b = in.nextInt();
            int count = 0;
            while (a != 0 && b != 0){
                if (b >= a && a != 0){
                    count += b/a;
                    b = b%a;
                }
                if (a > b && b != 0){
                    count += a/b;
                    a = a%b;
                }
            }
            System.out.println(count);
            pairs--;
        }
    }

}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.*;
import java.util.*;

public class Mai {

	public static void main(String[] args) throws IOException{
		Scanner cin = new Scanner(System.in);
		
		int t, n, m;
		
		t = cin.nextInt();
		
		while(t > 0) {
			t--;
			int sum = 0;
			n = cin.nextInt();
			m = cin.nextInt();
			while(n > 0 && m > 0) {
				if(n < m) {
					int k = n;
					n = m;
					m = k;
				}
				sum += n / m; n %= m;
			}
			
			System.out.println(sum);
		}
	}

}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.Scanner;

/**
 * Created by carolineshi on 3/30/17.
 */
public class Subtractions {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        while(t != 0) {
            int f = scan.nextInt();
            int s = scan.nextInt();
            System.out.println(ops(f, s));
            t--;
        }
    }

    public static int ops(int f, int s) {
        int ops = 0;

        while((f > 0) && (s > 0)) {
            if(f > s) {
                ops += f/s;
                f %= s;
            } else {
                //f <= s
                ops += s/f;
                s %= f;
            }
        }

        return ops;
    }

}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class CodeForces {

	public static void main(String[] args) throws IOException,NumberFormatException{
		try {
			FastScanner sc=new FastScanner();
			int t=sc.nextInt();
			while(t-->0) {
				int a=sc.nextInt(),b=sc.nextInt();
				int count=0;
				while(a!=0&&b!=0) {
					if(a>b) {
						int temp=a;
						a=b;
						b=temp;
					}
				    count+=(b/a);
				    b=b%a;
				}
				System.out.println(count);
			}			
			
		}
		catch(Exception e) {
			return ;
		}

	}
	
	
	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { 
                                      st=new StringTokenizer(br.readLine());				               
                              } catch (IOException e) {}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		
	}
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class CF267A {

	public static void main(String[] args) {
		int n=0, a, b;
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		try {
			n = Integer.parseInt(stdin.readLine());
		} catch (IOException e) {
		}
		while(n-->0){
			String[] row = null;
			try {
				row = stdin.readLine().split(" ");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			a = Integer.parseInt(row[0]);
			b = Integer.parseInt(row[1]);
			if(a<b) System.out.println(calc(a,b));
			else System.out.println(calc(b,a));
		}
	}
	
	static int calc(int a, int b){
		if(a==0) return 0;
		if(a==b) return 1;
		if(a==1) return b;
		else return b/a+calc(b%a, a);
	}

}
// Problem: 267_A. Subtractions
// Time complexity: constant

//package A;

import java.util.Scanner;

public class Solution {
    Scanner in = new Scanner(System.in);
    void run() throws Exception {
        int tests = in.nextInt();
        while (tests > 0) {
            --tests;
            int a = in.nextInt();
            int b = in.nextInt();
            int res = 0;
            while (a > 0 && b > 0) {
                if (a >= b) {
                    res += a / b;
                    a %= b;
                }
                else {
                    res += b / a;
                    b %= a;
                }
            }
            System.out.println(res);
        }
    }
    public static void main(String args[]) throws Exception {
        new Solution().run();
    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.Scanner;

public class Question267A {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while (t--!=0){
            int x=sc.nextInt();
            int y=sc.nextInt();
            int max=Math.max(x,y);
            int min=Math.min(x,y);
            int ans=0;
            while (min>0 && max>0){
                int temp=max;
                ans+=temp/min;
                max=min;
                min=temp%min;
           }
            System.out.println(ans);
        }
    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.Scanner;


public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        while(T!=0){
            T--;
            int a = in.nextInt();
            int b = in.nextInt();
            int ans=0;
            while(a>0&&b>0){
                if(a>b){
                    int c = a;
                    a = b;
                    b = c;
                }
                ans += (b-(b%a))/a;
                b = b%a;
            }
            System.out.println(ans);
        }
    }
    
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Subtraction {
    static long c=0;
    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(reader.readLine());
        while (n-->0){
            String l=reader.readLine();
            String[] a=l.split(" ");
            long A=Long.parseLong(a[0]);
            long B=Long.parseLong(a[1]);
            c=0;
            gcd(A,B);
            System.out.println(c);
        }
    }

    private static void gcd(long a, long b) {
        if (b==0)
            return ;
        c=c+a/b;
        gcd(b,a%b);
    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.*;

public class Subtractions {

	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int count = kb.nextInt();
		while(count > 0) {
			int smaller = kb.nextInt();
			int larger = kb.nextInt();
			int ops = 0;
			
			while(smaller > 0 && larger > 0) {
				if(smaller > larger) {
					int temp = smaller;
					smaller = larger;
					larger = temp;
				}
					
				ops += larger/smaller;
				larger = larger % smaller;
			}
			System.out.println(ops);
			count--;
		}

	}

}
// Problem: 267_A. Subtractions
// Time complexity: constant

import java.util.Scanner;

public class Sub
{
	public static void main(String[] args)
	{
		Scanner scan=new Scanner(System.in);
		int noOfPairs=scan.nextInt();
		while(noOfPairs-->0)
		{
			int x=scan.nextInt();
			int y=scan.nextInt();
			int res=0;
			while(x!=0&&y!=0)
			{
			  if(x>y) 
			   {
				res+=x/y;
				x=x%y;
			   }
			  else 
			   {
				  res+=y/x;
				  y=y%x;
			   }
			}
			System.out.println(res);
		}
		scan.close();
	}
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.Scanner;

public class Subtractions {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int t=s.nextInt();
		while(t--!=0){
			int a=s.nextInt();
			int b=s.nextInt();
			int min=Math.min(a, b);
			int max=Math.max(a, b);
			int ops=0;
			while(true){
				int quo=max/min;
				ops+=quo;
				int rem=max%min;
				max=Math.max(rem, min);
				min=Math.min(min, rem);
				if(rem==0) break;
			}
			System.out.println(ops);
		}
	}

}
// Problem: 267_A. Subtractions
// Time complexity: constant
//david alexander
import java.util.*;

public class Subtract {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a,b;
		String answer = "";
		while(n!=0){
			a = sc.nextInt();
			b = sc.nextInt();
			answer += solve(a,b) + "\n";
			n--;
		}
		System.out.println(answer);
	}
	
	public static int solve(int a, int b){
		int count = 0;
		int div;
		int mod;
		while(true){
			if(a >= b){
				div = a/b;
				mod = a%b;
				count += div;
				if(mod==0){
					return count;
				}
				else{
					a = mod;
				}
			}
			else{
				div = b/a;
				mod = b%a;
				count += div;
				if(mod==0){
					return count;
				}
				else{
					b = mod;
				}
			}
		}
	}
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException{
		Scanner cin = new Scanner(System.in);
		
		int t, n, m;
		
		t = cin.nextInt();
		
		while(t > 0) {
			t--;
			int sum = 0;
			n = cin.nextInt();
			m = cin.nextInt();
			while(n > 0 && m > 0) {
				if(n < m) {
					int k = n;
					n = m;
					m = k;
				}
				sum += n / m; n %= m;
			}
			
			System.out.println(sum);
		}
	}

}
// Problem: 267_A. Subtractions
// Time complexity: constant
/*
(7 10)  1 2 3
(3, 7)
(1, 3)

(3, 7)
(3, 4)
(3, 1)
(2, 1)
(1, 1)
1

*/
import java.util.*;
public class CodeForcesW8P2 {

    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);

        int tests = Integer.valueOf(sc.nextLine());


        while(tests > 0){
            int count = 0;
            String [] input = sc.nextLine().split(" ");
            int x = Integer.valueOf(input[0]);
            int y = Integer.valueOf(input[1]);


            if (x == y){
                count += 1;
            }
            else {
                if (x > y){
                    int temp = x;
                    x = y;
                    y = temp;
                }
                /*
                    (4, 17) 4 + 4
                    (1, 4)

                    (4, 16) 4
                    (4, 12)
                    (4, 8)
                    (4, 4)

                */
                while (x != 1 && x != 0 && y != 1){
                    count += (y / x);
                    int temp = x;
                    x = (y % x);
                    y = temp;
                }
                if (x != 0)
                    count += y;


            }



            System.out.println(count);
            tests --;
        }

    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.*;
import java.io.*;
 
public class Solution {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        s.nextLine();
        while(s.hasNext()) {
            int first = s.nextInt();
            int second = s.nextInt();
            System.out.println(calculate(first,second));
        }
    }
    
    public static int calculate(int first, int second) {
        int operations = 0;
        while(first != 0 && second != 0) {
            int temp;
            if(first < second) {
                temp = second/first;
                operations += temp;
                second -= (first*temp);
            }
            else {
                temp = first/second;
                operations += temp;
                first -= (second*temp);
            }
        }
        return operations;
    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int t = in.readInt();
            while (t-- > 0) {
                int[] a = new int[]{in.readInt(), in.readInt()};
                Arrays.sort(a);
                int ans = 0;
                while (a[0] > 0) {
                    int x = a[1] / a[0];
                    ans += x;
                    a[1] -= a[0] * x;
                    Arrays.sort(a);
                }
                out.println(ans);

            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

        public 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 boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.Scanner;

public class sub {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int num = in.nextInt();
		while(num-->0) {
			int a = in.nextInt();
			int b = in.nextInt();

			int res = 0;

			while(a!=0 && b!=0) {
				if(a>=b) {
					res += a/b;
					a %= b;
				} else {
					res += b/a;
					b %= a;
				}
			}
			System.out.println(res);
		}
	}
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.Scanner;


public class Subtractions {
	
	
	
	
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int test=sc.nextInt();
		while(test-->0){
			long a=sc.nextLong();
			long b=sc.nextLong();
			long count=0;
			long cnt=0;
			while(a>0&&b>0){
				count=0;
				//System.out.println(a+" "+b);
			if(a>b){
			count+=(a-b)/b;
			if(count!=0){
			cnt+=count;
			a-=b*count;}
			else {
				cnt++;
				a-=b;
			}
			}
			else{ 
				count+=(b-a)/a;
				if(count!=0){
				cnt+=count;
			b-=a*count;}
				else {
					cnt++;
					b-=a;
				}
			}
			}
		System.out.println(cnt);
		}
		
		
		
	}

}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class StrangeAddition {

	public static void main(String[] args) throws IOException {
		PrintWriter out = new PrintWriter(System.out);
		sc = new StringTokenizer(br.readLine());
		int tc = nxtInt();
		while (tc-- > 0) {
			int a = nxtInt();
			int b = nxtInt();
			int ans = 0;
			while (a != b) {
				if (a == 0 || b == 0)
					break;
				if (a > b) {
					int div = a / b;
					a -= b * div;
					ans += div;
				} else {
					int div = b / a;
					b -= a * div;
					ans += div;
				}
			}
			out.println(ans + (a == b ? 1 : 0));
		}
		br.close();
		out.close();
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(
			System.in));

	static StringTokenizer sc;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}
}
// Problem: 267_A. Subtractions
// Time complexity: constant
import java.util.Scanner;

public class Subtractions {

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        while (t-- > 0) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            int res = 0;
            while (a != 0 && b != 0) {
                if (a > b) {
                    res += (a / b);
                    a %= b;
                } else {
                    res += (b / a);
                    b %= a;
                }
            }
            System.out.println(res);

        }
    }
}