using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static string getNext(string current)
    {
        if (current.Length == 1)
        {
            var num = int.Parse(current);
            if (num < 9)
            {
                return (num + 1).ToString();
            }
            else
            {
                return (11).ToString();
            }
        }
        var first = int.Parse(current[0].ToString());
        var last = int.Parse(current[current.Length - 1].ToString());

        var sb = new StringBuilder(current);
        for (var i = 1; i < current.Length - 1; i++)
        {
            sb[i] = '0';
        }

        if (last < first)
        {
            last = first;

            sb[current.Length - 1] = char.Parse(last.ToString());
            return sb.ToString();
        }
        else
        {
            first++;
            if (first == 10)
            {
                first = 1;
                sb.Insert(0, char.Parse(first.ToString()));
            }
            last = first;
            sb[current.Length - 1] = char.Parse(last.ToString());
            sb[0] = char.Parse(first.ToString());
            return sb.ToString();
        }

    }

    static List<int> GetAllGcd(int num)
    {
        var all = new List<int>();
        for (int i = 2; i * i <= num; i++)
        {
            if (num % i == 0)
            {
                all.Add(i);
            }
            if (num % i == 0 && num / i != i)
            {
                all.Add(num / i);
            }
        }
        return all;
    }

    static int[] getWinningPos(int s)
    {
        var result = new int[25];
        var i = (s / 50) % 475;
        for(var j = 0; j < 25; j++)
        {
            i = (i * 96 + 42) % 475;
            result[j] = 26 + i;
        }
        return result;
    }
    static void Main(String[] args)
    {
        var data = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        var place = data[0];
        var score = data[1];
        var enoughWinningPoints = data[2];

        var winningPos = getWinningPos(score);

        var posScore = score;
        while(posScore >= enoughWinningPoints)
        {
            winningPos = getWinningPos(posScore);
            for (var i = 0; i < 25; i++)
            {
                if (winningPos[i] == place)
                {
                    Console.WriteLine(0);
                    return;
                }
            }
            posScore -= 50;
        }

        var second = 0;
        long result = 0;
        posScore = score + 50;
        while (true)
        {
            if(second % 2 == 0)
            {
                result++;
            }
            winningPos = getWinningPos(posScore);
            for (var i = 0; i < 25; i++)
            {
                if (winningPos[i] == place)
                {
                    Console.WriteLine(result);
                    return;
                }
            }
            posScore += 50;
            second++;
        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public PairVariable()
    {
        a = b = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;

    }

    public int CompareTo(PairVariable other)
    {
        return this.a.CompareTo(other.a);
    }
}

namespace ConsoleApplication254
{

    class Program
    {

        static bool foo(int x, int p)
        {

            long ii = (x / 50) % 475;
            List<long> t = new List<long>();
            for (long i = 0; i < 25; i++)
            {

                ii = (ii * 96 + 42) % 475;

                if (ii + 26 == p)
                {
                    return true;
                }
            }

            return false;
        }
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();
            int p = int.Parse(ss[0]);
            int x = int.Parse(ss[1]);
            int y = int.Parse(ss[2]);
            if (foo(x, p))
            {
                Console.WriteLine(0);
                return;
            }
            while (true)
            {
                if (foo(y, p) && Math.Abs(y - x) % 50 == 0)
                {
                    break;
                }
                y++;
            }
            if (y < x)
            {
                Console.WriteLine(0);
            }
            else
            {
                if ((x - y) % 100 == 0)
                {
                    Console.WriteLine((y - x) / 100);
                }
                else
                {
                    Console.WriteLine((y-(x-50)) / 100);
                }
            }

        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solution
{
    public void Solve()
    {
        for (int tt = ReadInt(); tt > 0; tt--)
        {
            int n = ReadInt();
            bool f = true;
            for (int i = 2; f && i * i <= n; i++)
                if (n % i == 0)
                {
                    int u = n / i;
                    int v = n - u;
                    Write(u, v);
                    f = false;
                }
            if (f)
                Write(1, n - 1);
        }
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUGLOCAL
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solution().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array) writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
    #endregion
}


namespace ContestRuns
{
    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.IO;
    //using System.Linq;
    using System.Text;

    using System.Linq;
    //using contests;

    class Program
    {

#if DEBUG
        static readonly TextReader input = File.OpenText(@"../../A/A.in");
        static readonly TextWriter output = File.CreateText(@"../../A/A.out");
#else
        static readonly TextReader input = Console.In;
        static readonly TextWriter output = Console.Out;
#endif

        public class Interval
        {
            public int Start { get; set; }
            public int End { get; set; }
            public int Index { get; set; }
        }

        private static void SolveB()
        {
            int T = int.Parse(input.ReadLine());

            for (int t = 0; t < T; ++t)
            {
                //var xy = input.ReadLine().Split(' ').Select(long.Parse).ToArray();
                long n = int.Parse(input.ReadLine());

                long res = 1;
                for (long i = 2; i*i <=n; ++i)
                {
                    if (n % i == 0)
                    {
                        res = n / i;
                        break;
                    }
                }

                output.WriteLine(res + " " + (n - res));
            }
        }

        static void Main(string[] args)
        {
            SolveB();
            output.Flush();
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
namespace Program
{
    public static class CODEFORCES1
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var n = NN;
            var m = NN;
            var ab = Repeat(0, m).Select(_ => new { a = NN - 1, b = NN - 1 }).ToArray();
            var path = Repeat(0, n).Select(_ => new List<long>()).ToArray();
            foreach (var item in ab)
            {
                path[item.a].Add(item.b);
                path[item.b].Add(item.a);
            }
            Func<long[], long> checker = cnter =>
            {
                var done = new bool[n, n];
                var used = new bool[7, 7];
                var ans2 = 0;
                foreach (var item in ab)
                {
                    if (done[item.a, item.b]) continue;
                    done[item.a, item.b] = true;
                    done[item.b, item.a] = true;
                    if (!used[cnter[item.a], cnter[item.b]])
                    {
                        ++ans2;
                        used[cnter[item.a], cnter[item.b]] = true;
                        used[cnter[item.b], cnter[item.a]] = true;
                    }
                }
                return ans2;
            };
            var ans = 0L;
            var counter = new long[7];
            for (counter[0] = 1; counter[0] < 7; counter[0]++)
                for (counter[1] = 1; counter[1] < 7; counter[1]++)
                    for (counter[2] = 1; counter[2] < 7; counter[2]++)
                        for (counter[3] = 1; counter[3] < 7; counter[3]++)
                            for (counter[4] = 1; counter[4] < 7; counter[4]++)
                                for (counter[5] = 1; counter[5] < 7; counter[5]++)
                                    for (counter[6] = 1; counter[6] < 7; counter[6]++)
                                    {
                                        ans = Max(ans, checker(counter));
                                    }
            Console.WriteLine(ans);
        }
        static public void Main(string[] args) { if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static void RevSort<T>(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); }
        static void RevSort<T>(T[] l, Comparison<T> comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); }
        static IEnumerable<long> Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; }
        static IEnumerable<long> Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; }
        static IEnumerable<long> Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } }
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
        static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; }
        static long LCM(long a, long b) => a * b / GCD(a, b);
        static Mat<T> Pow<T>(Mat<T> x, long y) => Mat<T>.Pow(x, y);
        static Mod Pow(Mod x, long y) { Mod a = 1; while (y != 0) { if ((y & 1) == 1) a.Mul(x); x.Mul(x); y >>= 1; } return a; }
        static long Pow(long x, long y) { long a = 1; while (y != 0) { if ((y & 1) == 1) a *= x; x *= x; y >>= 1; } return a; }
        static List<long> _fact = new List<long>() { 1 };
        static void _B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }
        static long Comb(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }
        static long Perm(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; }
        static Func<TR> Lambda<TR>(Func<Func<TR>, TR> f) { Func<TR> t = () => default(TR); return t = () => f(t); }
        static Func<T1, TR> Lambda<T1, TR>(Func<T1, Func<T1, TR>, TR> f) { Func<T1, TR> t = x1 => default(TR); return t = x1 => f(x1, t); }
        static Func<T1, T2, TR> Lambda<T1, T2, TR>(Func<T1, T2, Func<T1, T2, TR>, TR> f) { Func<T1, T2, TR> t = (x1, x2) => default(TR); return t = (x1, x2) => f(x1, x2, t); }
        static Func<T1, T2, T3, TR> Lambda<T1, T2, T3, TR>(Func<T1, T2, T3, Func<T1, T2, T3, TR>, TR> f) { Func<T1, T2, T3, TR> t = (x1, x2, x3) => default(TR); return t = (x1, x2, x3) => f(x1, x2, x3, t); }
        static Func<T1, T2, T3, T4, TR> Lambda<T1, T2, T3, T4, TR>(Func<T1, T2, T3, T4, Func<T1, T2, T3, T4, TR>, TR> f) { Func<T1, T2, T3, T4, TR> t = (x1, x2, x3, x4) => default(TR); return t = (x1, x2, x3, x4) => f(x1, x2, x3, x4, t); }
        static List<T> LCS<T>(T[] s, T[] t) where T : IEquatable<T> { int sl = s.Length, tl = t.Length; var dp = new int[sl + 1, tl + 1]; for (var i = 0; i < sl; i++) for (var j = 0; j < tl; j++) dp[i + 1, j + 1] = s[i].Equals(t[j]) ? dp[i, j] + 1 : Max(dp[i + 1, j], dp[i, j + 1]); { var r = new List<T>(); int i = sl, j = tl; while (i > 0 && j > 0) if (s[--i].Equals(t[--j])) r.Add(s[i]); else if (dp[i, j + 1] > dp[i + 1, j]) ++j; else ++i; r.Reverse(); return r; } }
        static long LIS<T>(T[] array, bool strict) { var l = new List<T>(); foreach (var e in array) { var i = l.BinarySearch(e); if (i < 0) i = ~i; else if (!strict) ++i; if (i == l.Count) l.Add(e); else l[i] = e; } return l.Count; }
        class PQ<T> where T : IComparable
        {
            List<T> h; Comparison<T> c; public T Peek => h[0]; public int Count => h.Count;
            public PQ(int cap, Comparison<T> c, bool asc = true) { h = new List<T>(cap); this.c = asc ? c : (x, y) => c(y, x); }
            public PQ(Comparison<T> c, bool asc = true) { h = new List<T>(); this.c = asc ? c : (x, y) => c(y, x); }
            public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }
            public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }
            public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; }
            public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; }
        }
        class PQ<TK, TV> where TK : IComparable
        {
            PQ<Tuple<TK, TV>> q; public Tuple<TK, TV> Peek => q.Peek; public int Count => q.Count;
            public PQ(int cap, Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>(cap, (x, y) => c(x.Item1, y.Item1), asc); }
            public PQ(Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>((x, y) => c(x.Item1, y.Item1), asc); }
            public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }
            public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }
            public void Push(TK k, TV v) => q.Push(Tuple.Create(k, v));
            public Tuple<TK, TV> Pop() => q.Pop();
        }
        public class UF
        {
            long[] d;
            public UF(long s) { d = Repeat(-1L, s).ToArray(); }
            public bool Unite(long x, long y) { x = Root(x); y = Root(y); if (x != y) { if (d[y] < d[x]) { var t = y; y = x; x = t; } d[x] += d[y]; d[y] = x; } return x != y; }
            public bool IsSame(long x, long y) => Root(x) == Root(y);
            public long Root(long x) => d[x] < 0 ? x : d[x] = Root(d[x]);
            public long Count(long x) => -d[Root(x)];
        }
        struct Mod : IEquatable<Mod>, IEquatable<long>
        {
            static public long _mod = 1000000007; long v;
            public Mod(long x) { if (x < _mod && x >= 0) v = x; else if ((v = x % _mod) < 0) v += _mod; }
            static public implicit operator Mod(long x) => new Mod(x);
            static public implicit operator long(Mod x) => x.v;
            public void Add(Mod x) { if ((v += x.v) >= _mod) v -= _mod; }
            public void Sub(Mod x) { if ((v -= x.v) < 0) v += _mod; }
            public void Mul(Mod x) => v = (v * x.v) % _mod;
            public void Div(Mod x) => v = (v * Inverse(x.v)) % _mod;
            static public Mod operator +(Mod x, Mod y) { var t = x.v + y.v; return t >= _mod ? new Mod { v = t - _mod } : new Mod { v = t }; }
            static public Mod operator -(Mod x, Mod y) { var t = x.v - y.v; return t < 0 ? new Mod { v = t + _mod } : new Mod { v = t }; }
            static public Mod operator *(Mod x, Mod y) => x.v * y.v;
            static public Mod operator /(Mod x, Mod y) => x.v * Inverse(y.v);
            static public bool operator ==(Mod x, Mod y) => x.v == y.v;
            static public bool operator !=(Mod x, Mod y) => x.v != y.v;
            static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }
            public bool Equals(Mod x) => v == x.v;
            public bool Equals(long x) => v == x;
            public override bool Equals(object x) => x == null ? false : Equals((Mod)x);
            public override int GetHashCode() => v.GetHashCode();
            public override string ToString() => v.ToString();
            static List<Mod> _fact = new List<Mod>() { 1 };
            static void B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }
            static public Mod Comb(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }
            static public Mod Perm(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; }
        }
        struct Mat<T>
        {
            T[,] m;
            public Mat(T[,] v) { m = (T[,])v.Clone(); }
            static public implicit operator Mat<T>(T[,] v) => new Mat<T>(v);
            public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } }
            static public Mat<T> operator +(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; }
            static public Mat<T> operator +(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; }
            static public Mat<T> operator -(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; }
            static public Mat<T> operator -(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; }
            static public Mat<T> operator *(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; }
            static public Mat<T> operator *(Mat<T> a, Mat<T> b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; }
            static public Mat<T> Pow(Mat<T> x, long y) { var n = x.m.GetLength(0); var t = (Mat<T>)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; }
        }
        class Tree
        {
            long N; int l; List<long>[] p; int[] d; long[][] pr; long r; Tuple<long, long, int>[] e; Tuple<long, long>[] b; bool lca; bool euler; bool bfs;
            public Tree(List<long>[] p_, long r_) { N = p_.Length; p = p_; r = r_; lca = false; euler = false; }
            public Tuple<long, long>[] BFSRoot() { if (!bfs) { var nb = new List<Tuple<long, long>>(); var q = new Queue<long>(); var d = new bool[N]; nb.Add(Tuple.Create(r, -1L)); d[r] = true; q.Enqueue(r); while (q.Count > 0) { var w = q.Dequeue(); foreach (var i in p[w]) { if (d[i]) continue; d[i] = true; q.Enqueue(i); nb.Add(Tuple.Create(i, w)); } } b = nb.ToArray(); bfs = true; } return b; }
            public Tuple<long, long>[] BFSLeaf() => BFSRoot().Reverse().ToArray();
            public Tuple<long, long, int>[] Euler() { if (!euler) { var ne = new List<Tuple<long, long, int>>(); var s = new Stack<Tuple<long, long>>(); var d = new bool[N]; d[r] = true; s.Push(Tuple.Create(r, -1L)); while (s.Count > 0) { var w = s.Peek(); var ad = true; foreach (var i in p[w.Item1]) { if (d[i]) continue; d[i] = true; ad = false; s.Push(Tuple.Create(i, w.Item1)); } if (!ad || p[w.Item1].Count == 1) ne.Add(Tuple.Create(w.Item1, w.Item2, 1)); if (ad) { s.Pop(); ne.Add(Tuple.Create(w.Item1, w.Item2, -1)); } } e = ne.ToArray(); euler = true; } return e; }
            public long LCA(long u, long v) { if (!lca) { l = 0; while (N > (1 << l)) l++; d = new int[N]; pr = Repeat(0, l).Select(_ => new long[N]).ToArray(); d[r] = 0; pr[0][r] = -1; var q = new Stack<long>(); q.Push(r); while (q.Count > 0) { var w = q.Pop(); foreach (var i in p[w]) { if (i == pr[0][w]) continue; q.Push(i); d[i] = d[w] + 1; pr[0][i] = w; } } for (var k = 0; k + 1 < l; k++) for (var w = 0; w < N; w++) if (pr[k][w] < 0) pr[k + 1][w] = -1; else pr[k + 1][w] = pr[k][pr[k][w]]; lca = true; } if (d[u] > d[v]) { var t = u; u = v; v = t; } for (var k = 0; k < l; k++) if ((((d[v] - d[u]) >> k) & 1) != 0) v = pr[k][v]; if (u == v) return u; for (var k = l - 1; k >= 0; k--) if (pr[k][u] != pr[k][v]) { u = pr[k][u]; v = pr[k][v]; } return pr[0][u]; }
        }
        class Graph
        {
            int n; List<Tuple<int, int, long>> pathList; Dictionary<int, long>[] vtxPath; long INF = (long.MaxValue >> 1) - 1;
            public Graph(long _n)
            {
                n = (int)_n;
                pathList = new List<Tuple<int, int, long>>();
                vtxPath = Repeat(0, n).Select(_ => new Dictionary<int, long>()).ToArray();
            }
            public void AddPath(long a, long b, long c)
            {
                pathList.Add(Tuple.Create((int)a, (int)b, c));
                vtxPath[a][(int)b] = vtxPath[a].ContainsKey((int)b) ? Min(vtxPath[a][(int)b], c) : c;
            }
            public long[,] WarshallFloyd()
            {
                var ret = new long[n, n];
                for (var i = 0; i < n; i++)
                    for (var j = 0; j < n; j++)
                        ret[i, j] = vtxPath[i].ContainsKey(j) ? vtxPath[i][j] : INF;
                for (var k = 0; k < n; k++)
                    for (var i = 0; i < n; i++)
                        for (var j = 0; j < n; j++)
                            ret[i, j] = Min(ret[i, j], ret[i, k] + ret[k, j]);
                return ret;
            }
            public Tuple<long[], int?[], bool[]> BellmanFord(long s)
            {
                var dist = Repeat(INF, n).ToArray();
                var pred = new int?[n];
                var neg = new bool[n];
                dist[s] = 0;
                for (var i = 1; i < n; i++)
                    foreach (var path in pathList)
                        if (dist[path.Item2] > (dist[path.Item1] == INF ? INF : dist[path.Item1] + path.Item3))
                        {
                            dist[path.Item2] = dist[path.Item1] + path.Item3;
                            pred[path.Item2] = path.Item1;
                        }
                for (var i = 0; i < n; i++)
                    foreach (var path in pathList)
                        if (dist[path.Item2] > (dist[path.Item1] == INF ? INF : dist[path.Item1] + path.Item3) || neg[path.Item1])
                        {
                            dist[path.Item2] = dist[path.Item1] + path.Item3;
                            neg[path.Item2] = true;
                        }
                return Tuple.Create(dist, pred, neg);
            }
            public Tuple<long[], int?[]> Dijkstra(long s)
            {
                var dist = Repeat(long.MaxValue >> 2, n).ToArray();
                var pred = new int?[n];
                dist[s] = 0;
                var q = new PQ<long, int>();
                q.Push(0, (int)s);
                while (q.Count > 0)
                {
                    var u = q.Pop().Item2;
                    foreach (var path in vtxPath[u])
                    {
                        var v = path.Key;
                        var alt = dist[u] + path.Value;
                        if (dist[v] > alt)
                        {
                            dist[v] = alt;
                            pred[v] = u;
                            q.Push(alt, v);
                        }
                    }
                }
                return Tuple.Create(dist, pred);
            }
        }
        class BT<T> where T : IComparable
        {
            class Node { public Node l; public Node r; public T v; public bool b; public int c; }
            Comparison<T> c; Node r; bool ch; T lm;
            public BT(Comparison<T> _c) { c = _c; }
            public BT() : this((x, y) => x.CompareTo(y)) { }
            bool R(Node n) => n != null && !n.b;
            bool B(Node n) => n != null && n.b;
            long C(Node n) => n?.c ?? 0;
            Node RtL(Node n) { Node m = n.r, t = m.l; m.l = n; n.r = t; n.c -= m.c - (t?.c ?? 0); m.c += n.c - (t?.c ?? 0); return m; }
            Node RtR(Node n) { Node m = n.l, t = m.r; m.r = n; n.l = t; n.c -= m.c - (t?.c ?? 0); m.c += n.c - (t?.c ?? 0); return m; }
            Node RtLR(Node n) { n.l = RtL(n.l); return RtR(n); }
            Node RtRL(Node n) { n.r = RtR(n.r); return RtL(n); }
            public void Add(T x) { r = A(r, x); r.b = true; }
            Node A(Node n, T x) { if (n == null) { ch = true; return new Node() { v = x, c = 1 }; } if (c(x, n.v) < 0) n.l = A(n.l, x); else n.r = A(n.r, x); n.c++; return Bl(n); }
            Node Bl(Node n) { if (!ch) return n; if (!B(n)) return n; if (R(n.l) && R(n.l.l)) { n = RtR(n); n.l.b = true; } else if (R(n.l) && R(n.l.r)) { n = RtLR(n); n.l.b = true; } else if (R(n.r) && R(n.r.l)) { n = RtRL(n); n.r.b = true; } else if (R(n.r) && R(n.r.r)) { n = RtL(n); n.r.b = true; } else ch = false; return n; }
            public void Remove(T x) { r = Rm(r, x); if (r != null) r.b = true; }
            Node Rm(Node n, T x) { if (n == null) { ch = false; return n; } n.c--; var r = c(x, n.v); if (r < 0) { n.l = Rm(n.l, x); return BlL(n); } if (r > 0) { n.r = Rm(n.r, x); return BlR(n); } if (n.l == null) { ch = n.b; return n.r; } n.l = RmM(n.l); n.v = lm; return BlL(n); }
            Node RmM(Node n) { n.c--; if (n.r != null) { n.r = RmM(n.r); return BlR(n); } lm = n.v; ch = n.b; return n.l; }
            Node BlL(Node n) { if (!ch) return n; if (B(n.r) && R(n.r.l)) { var b = n.b; n = RtRL(n); n.b = b; n.l.b = true; ch = false; } else if (B(n.r) && R(n.r.r)) { var b = n.b; n = RtL(n); n.b = b; n.r.b = true; n.l.b = true; ch = false; } else if (B(n.r)) { ch = n.b; n.b = true; n.r.b = false; } else { n = RtL(n); n.b = true; n.l.b = false; n.l = BlL(n.l); ch = false; } return n; }
            Node BlR(Node n) { if (!ch) return n; if (B(n.l) && R(n.l.r)) { var b = n.b; n = RtLR(n); n.b = b; n.r.b = true; ch = false; } else if (B(n.l) && R(n.l.l)) { var b = n.b; n = RtR(n); n.b = b; n.l.b = true; n.r.b = true; ch = false; } else if (B(n.l)) { ch = n.b; n.b = true; n.l.b = false; } else { n = RtR(n); n.b = true; n.r.b = false; n.r = BlR(n.r); ch = false; } return n; }
            public T this[long i] { get { return At(r, i); } }
            T At(Node n, long i) { if (n == null) return default(T); if (n.l == null) if (i == 0) return n.v; else return At(n.r, i - 1); if (n.l.c == i) return n.v; if (n.l.c > i) return At(n.l, i); return At(n.r, i - n.l.c - 1); }
            public bool Have(T x) { var t = FindUpper(x); return t < C(r) && At(r, t).CompareTo(x) == 0; }
            public long FindUpper(T x, bool allowSame = true) => allowSame ? FL(r, x) + 1 : FU(r, x);
            long FU(Node n, T x) { if (n == null) return 0; var r = c(x, n.v); if (r < 0) return FU(n.l, x); return C(n.l) + 1 + FU(n.r, x); }
            public long FindLower(T x, bool allowSame = true) { var t = FL(r, x); if (allowSame) return t + 1 < C(r) && At(r, t + 1).CompareTo(x) == 0 ? t + 1 : t < 0 ? C(r) : t; return t < 0 ? C(r) : t; }
            long FL(Node n, T x) { if (n == null) return -1; var r = c(x, n.v); if (r > 0) return C(n.l) + 1 + FL(n.r, x); return FL(n.l, x); }
            public T Min() { Node n = r, p = null; while (n != null) { p = n; n = n.l; } return p == null ? default(T) : p.v; }
            public T Max() { Node n = r, p = null; while (n != null) { p = n; n = n.r; } return p == null ? default(T) : p.v; }
            public bool Any() => r != null;
            public long Count() => C(r);
            public IEnumerable<T> List() => L(r);
            IEnumerable<T> L(Node n) { if (n == null) yield break; foreach (var i in L(n.l)) yield return i; yield return n.v; foreach (var i in L(n.r)) yield return i; }
        }
        class Dict<K, V> : Dictionary<K, V>
        {
            Func<K, V> d;
            public Dict(Func<K, V> _d) { d = _d; }
            public Dict() : this(_ => default(V)) { }
            new public V this[K i] { get { V v; return TryGetValue(i, out v) ? v : base[i] = d(i); } set { base[i] = value; } }
        }
        class Deque<T>
        {
            T[] b; int o, c;
            public int Count;
            public T this[int i] { get { return b[gi(i)]; } set { b[gi(i)] = value; } }
            public Deque(int cap = 16) { b = new T[c = cap]; }
            int gi(int i) { if (i >= c) throw new Exception(); var r = o + i; return r >= c ? r - c : r; }
            public void PushFront(T x) { if (Count == c) e(); if (--o < 0) o += b.Length; b[o] = x; ++Count; }
            public T PopFront() { if (Count-- == 0) throw new Exception(); var r = b[o++]; if (o >= c) o -= c; return r; }
            public T Front => b[o];
            public void PushBack(T x) { if (Count == c) e(); var i = o + Count++; b[i >= c ? i - c : i] = x; }
            public T PopBack() { if (Count == 0) throw new Exception(); return b[gi(--Count)]; }
            public T Back => b[gi(Count - 1)];
            void e() { T[] nb = new T[c << 1]; if (o > c - Count) { var l = b.Length - o; Array.Copy(b, o, nb, 0, l); Array.Copy(b, 0, nb, l, Count - l); } else Array.Copy(b, o, nb, 0, Count); b = nb; o = 0; c <<= 1; }
            public void Insert(int i, T x) { if (i > Count) throw new Exception(); this.PushFront(x); for (int j = 0; j < i; j++) this[j] = this[j + 1]; this[i] = x; }
            public T RemoveAt(int i) { if (i < 0 || i >= Count) throw new Exception(); var r = this[i]; for (int j = i; j > 0; j--) this[j] = this[j - 1]; this.PopFront(); return r; }
        }
        class SegTree<T>
        {
            int n; T ti; Func<T, T, T> f; T[] dat;
            public SegTree(long _n, T _ti, Func<T, T, T> _f) { n = 1; while (n < _n) n <<= 1; ti = _ti; f = _f; dat = Repeat(ti, n << 1).ToArray(); for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public SegTree(List<T> l, T _ti, Func<T, T, T> _f) : this(l.Count, _ti, _f) { for (var i = 0; i < l.Count; i++) dat[n + i] = l[i]; for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public void Update(long i, T v) { dat[i += n] = v; while ((i >>= 1) > 0) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public T Query(long l, long r) { var vl = ti; var vr = ti; for (long li = n + l, ri = n + r; li < ri; li >>= 1, ri >>= 1) { if ((li & 1) == 1) vl = f(vl, dat[li++]); if ((ri & 1) == 1) vr = f(dat[--ri], vr); } return f(vl, vr); }
            public T this[long idx] { get { return dat[idx + n]; } set { Update(idx, value); } }
        }
        class LazySegTree<T, E>
        {
            int n, height; T ti; E ei; Func<T, T, T> f; Func<T, E, T> g; Func<E, E, E> h; T[] dat; E[] laz;
            public LazySegTree(long _n, T _ti, E _ei, Func<T, T, T> _f, Func<T, E, T> _g, Func<E, E, E> _h) { n = 1; height = 0; while (n < _n) { n <<= 1; ++height; } ti = _ti; ei = _ei; f = _f; g = _g; h = _h; dat = Repeat(ti, n << 1).ToArray(); laz = Repeat(ei, n << 1).ToArray(); for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            public LazySegTree(List<T> l, T _ti, E _ei, Func<T, T, T> _f, Func<T, E, T> _g, Func<E, E, E> _h) : this(l.Count, _ti, _ei, _f, _g, _h) { for (var i = 0; i < l.Count; i++) dat[n + i] = l[i]; for (var i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]); }
            T Reflect(long i) => laz[i].Equals(ei) ? dat[i] : g(dat[i], laz[i]);
            void Eval(long i) { if (laz[i].Equals(ei)) return; laz[(i << 1) | 0] = h(laz[(i << 1) | 0], laz[i]); laz[(i << 1) | 1] = h(laz[(i << 1) | 1], laz[i]); dat[i] = Reflect(i); laz[i] = ei; }
            void Thrust(long i) { for (var j = height; j > 0; j--) Eval(i >> j); }
            void Recalc(long i) { while ((i >>= 1) > 0) dat[i] = f(Reflect((i << 1) | 0), Reflect((i << 1) | 1)); }
            public void Update(long l, long r, E v) { Thrust(l += n); Thrust(r += n - 1); for (long li = l, ri = r + 1; li < ri; li >>= 1, ri >>= 1) { if ((li & 1) == 1) { laz[li] = h(laz[li], v); ++li; } if ((ri & 1) == 1) { --ri; laz[ri] = h(laz[ri], v); } } Recalc(l); Recalc(r); }
            public T Query(long l, long r) { Thrust(l += n); Thrust(r += n - 1); var vl = ti; var vr = ti; for (long li = l, ri = r + 1; li < ri; li >>= 1, ri >>= 1) { if ((li & 1) == 1) vl = f(vl, Reflect(li++)); if ((ri & 1) == 1) vr = f(Reflect(--ri), vr); } return f(vl, vr); }
            public T this[long idx] { get { Thrust(idx += n); return dat[idx] = Reflect(idx); } set { Thrust(idx += n); dat[idx] = value; laz[idx] = ei; Recalc(idx); } }
        }
    }
}


using System;
using System.Linq;
using CompLib.Util;
using System.Threading;
using CompLib.Algorithm;
using CompLib.Graph;

public class Program
{
    private int N, M;
    private int[] A, B;

    private int[] Ar;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        M = sc.NextInt();
        A = new int[M];
        B = new int[M];
        for (int i = 0; i < M; i++)
        {
            A[i] = sc.NextInt() - 1;
            B[i] = sc.NextInt() - 1;
        }

        Ar = new int[N];

        Console.WriteLine(Go(0));
    }

    int Go(int i)
    {
        if (i >= N)
        {
            bool[,] f = new bool[6, 6];
            for (int j = 0; j < M; j++)
            {
                f[Ar[A[j]], Ar[B[j]]] = f[Ar[B[j]], Ar[A[j]]] = true;
            }

            int cnt = 0;
            for (int j = 0; j < 6; j++)
            {
                for (int k = j; k < 6; k++)
                {
                    if (f[j, k]) cnt++;
                }
            }

            return cnt;
        }

        int ans = int.MinValue;
        for (int j = 0; j < 6; j++)
        {
            Ar[i] = j;
            ans = Math.Max(ans, Go(i + 1));
        }

        return ans;
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Graph
{
    using System;
    using System.Collections.Generic;

    class AdjacencyList
    {
        private readonly int _n;
        private readonly List<(int f, int t)> _edges;

        private int[] _start;
        private int[] _eList;

        public AdjacencyList(int n)
        {
            _n = n;
            _edges = new List<(int f, int t)>();
        }

        public void AddDirectedEdge(int from, int to)
        {
            _edges.Add((from, to));
        }

        public void AddUndirectedEdge(int f, int t)
        {
            AddDirectedEdge(f, t);
            AddDirectedEdge(t, f);
        }

        public void Build()
        {
            _start = new int[_n + 1];
            foreach (var e in _edges)
            {
                _start[e.f + 1]++;
            }

            for (int i = 1; i <= _n; i++)
            {
                _start[i] += _start[i - 1];
            }

            int[] counter = new int[_n + 1];
            _eList = new int[_edges.Count];

            foreach (var e in _edges)
            {
                _eList[_start[e.f] + counter[e.f]++] = e.t;
            }
        }

        public ReadOnlySpan<int> this[int f]
        {
            get { return _eList.AsSpan(_start[f], _start[f + 1] - _start[f]); }
        }
    }
}

namespace CompLib.Algorithm
{
    using System;
    using System.Collections.Generic;

    public static partial class Algorithm
    {
        private static void Swap<T>(ref T a, ref T b)
        {
            T tmp = a;
            a = b;
            b = tmp;
        }

        private static void Reverse<T>(T[] array, int begin)
        {
            // [begin, array.Length)を反転
            if (array.Length - begin >= 2)
            {
                for (int i = begin, j = array.Length - 1; i < j; i++, j--)
                {
                    Swap(ref array[i], ref array[j]);
                }
            }
        }

        /// <summary>
        /// arrayを辞書順で次の順列にする 存在しないときはfalseを返す
        /// </summary>
        /// <param name="array"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static bool NextPermutation<T>(T[] array, Comparison<T> comparison)
        {
            for (int i = array.Length - 2; i >= 0; i--)
            {
                if (comparison(array[i], array[i + 1]) < 0)
                {
                    int j = array.Length - 1;
                    for (; j > i; j--)
                    {
                        if (comparison(array[i], array[j]) < 0)
                        {
                            break;
                        }
                    }

                    Swap(ref array[i], ref array[j]);
                    Reverse(array, i + 1);
                    return true;
                }
            }

            return false;
        }

        /// <summary>
        /// arrayを辞書順で次の順列にする 存在しないときはfalseを返す
        /// </summary>
        /// <param name="array"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static bool NextPermutation<T>(T[] array, Comparer<T> comparer) =>
            NextPermutation(array, comparer.Compare);

        /// <summary>
        /// arrayを辞書順で次の順列にする 存在しないときはfalseを返す
        /// </summary>
        /// <param name="array"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static bool NextPermutation<T>(T[] array) => NextPermutation(array, Comparer<T>.Default);
    }
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Дежурство
{
    class Program
    {
        static int SumOfNums(int x)
        {
            int sum = 0;
            string s = Convert.ToString(x);
            for (int i = 0; i < s.Length; i++)
            {
                sum += Convert.ToInt32(Convert.ToString(s[i]));
            }

            return sum;
        }
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());

            int x = 0;

            if (n > 100) x = n - 100;
            else x = 0;
            List<int> nums = new List<int>();
            while (x < n)
            {
                if (x + SumOfNums(x) == n) nums.Add(x);
                x++;
            }

            Console.WriteLine(nums.Count);
            for (int i = 0; i < nums.Count; i++) Console.WriteLine(nums[i]);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = new List<int>();

        int maxAdd = 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9;
        for (var add = maxAdd; add > 0; --add)
        {
            int cand = n - add;
            if (cand <= 0)
                continue;
            if (DigitsSum(cand) != add)
                continue;
            s.Add(cand);
        }
        Console.WriteLine(s.Count);
        if (s.Count > 0)
            Console.WriteLine(string.Join(Environment.NewLine, s));
    }

    static int DigitsSum(int n)
    {
        int sum = 0;
        do
        {
            sum += n % 10;
            n /= 10;
        }
        while (n > 0);
        return sum;
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeforcesSolver
{
    class Program
    {
        static void Main()
        {
            double striangle = Math.Sqrt(3)/4;
            var a = ReadArrayInt();

            var alpha = 2*Math.PI/3;

            double m0 = a[1]*Math.Sin(alpha) - a[2]*Math.Sin(alpha*2) + a[3]*Math.Sin(alpha*3) - a[4]*Math.Sin(alpha*4);
            double m1 = a[2]*Math.Sin(alpha) - a[3]*Math.Sin(alpha*2) + a[4]*Math.Sin(alpha*3);
            double m2 = a[3]*Math.Sin(alpha) - a[4]*Math.Sin(alpha*2);
            double m3 = a[4]*Math.Sin(alpha);

            double s = (a[0]*m0 + a[1]*m1 + a[2]*m2 + a[3]*m3)/2;

            int cnt = (int) Math.Round(s/striangle);

            Console.WriteLine(cnt);
        }

        #region Handy

        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        public static int[] ReadArrayInt()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));
        }

        public static string[] ReadArrayString()
        {
            return Console.ReadLine().Split(' ');
        }

        #endregion
    }
}


using System;
using System.Globalization;
using System.IO;
using System.Text;
using static System.Math;
using static System.Console;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    public void Solve()
    {
      var a = input.ReadIntArray(6);
      var p = a[0] + a[1] + a[2];
      Write(p * p - a[0] * a[0] - a[2] * a[2] - a[4] * a[4]);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public string ReadToEnd()
    {
      return reader.ReadToEnd();
    }

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
      var result = (char)c - '0';
      c = reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
        result = result * 10 + (char)c - '0';
        c = reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() =>
      (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() =>
      (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() =>
      (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}


using System;

class E
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		Console.WriteLine(Factorial(n) * 2 / n / n);
	}

	static long Factorial(int n) { for (long x = 1, i = 1; ; x *= ++i) if (i >= n) return x; }
}


using System;
using System.Collections.Generic;

namespace olympiada
{
    class Program
    {
        static void Merge(int[] array, int lowIndex, int middleIndex, int highIndex)
        {
            var left = lowIndex;
            var right = middleIndex + 1;
            var tempArray = new int[highIndex - lowIndex + 1];
            var tempB = new int[highIndex - lowIndex + 1];
            var index = 0;

            while ((left <= middleIndex) && (right <= highIndex))
            {
                if (array[left] < array[right])
                {
                    tempArray[index] = array[left];
                    left++;
                }
                else
                {
                    tempArray[index] = array[right];
                    right++;
                }

                index++;
            }

            for (var i = left; i <= middleIndex; i++)
            {
                tempArray[index] = array[i];
                index++;
            }

            for (var i = right; i <= highIndex; i++)
            {
                tempArray[index] = array[i];
                index++;
            }

            for (var i = 0; i < tempArray.Length; i++)
            {
                array[lowIndex + i] = tempArray[i];
            }
        }

        static int[] MergeSort(int[] array, int lowIndex, int highIndex)
        {
            if (lowIndex < highIndex)
            {
                var middleIndex = (lowIndex + highIndex) / 2;
                MergeSort(array, lowIndex, middleIndex);
                MergeSort(array, middleIndex + 1, highIndex);
                Merge(array, lowIndex, middleIndex, highIndex);
            }

            return array;
        }

        static int[] MergeSort(int[] array)
        {
            return MergeSort(array, 0, array.Length - 1);
        }
        static long factorial(long n)
        {
            long res = 1;
            for(int i=1; i<=n; i++)
            {
                res *= i;
            }
            return res;
        }
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long c = factorial(n) / (factorial(n / 2) * factorial(n / 2));
            long p = factorial(n / 2 - 1);
            Console.WriteLine(c * p * p/2);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest.Codeforces.Round63
{
    class D
    {
        int[,,] win = new int[4,500, 500];
        int offset = 200;
        int[] vx, vy;
        int d;

        bool isLose(int x, int y) { return d*d < x*x + y*y; }

        bool solve(int reflect, int x, int y)
        {
            if (isLose(x, y))
                return true;

            if (win[reflect, x + offset, y + offset] != 0)
                return win[reflect, x + offset, y + offset] > 0;

            if (reflect % 2 == 1)
            {
                if (!solve(reflect >> 1, y, x))
                    return (win[reflect, x + offset, y + offset] = 1) > 0;
            }

            int r = ((reflect % 2) << 1) | (reflect >> 1);
            for (int i = 0; i < vx.Length; i++)
                if (!solve(r, x + vx[i], y + vy[i]))
                    return (win[reflect, x + offset, y + offset] = 1) > 0;

            return (win[reflect, x + offset, y + offset] = -1) > 0;
        }

        D()
        {
            var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));
            int x = xs[0],
                y = xs[1],
                n = xs[2];
            d = xs[3];
            vx = new int[n];
            vy = new int[n];
            for (int i = 0; i < n; i++)
            {
                var ys = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));
                vx[i] = ys[0];
                vy[i] = ys[1];
            }
            Console.WriteLine(solve(3, x, y) ? "Anton" : "Dasha");
        }

        public static void Main()
        {
            new D();
        }
    }
}


using System;
using System.IO;
using System.Text;

namespace A_Student_s_Dream
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int al = Next();
            int ar = Next();

            int bl = Next();
            int br = Next();

            bool ok = al <= br + 1 && br <= (al + 1)*2;
            ok = ok || (ar <= bl + 1 && bl <= (ar + 1)*2);

            writer.WriteLine(ok ? "YES" : "NO");
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest.Codeforces.Round58
{
    class A
    {
        // 1 -> 4, 2 -> 6
        static bool ok(int g, int b)
        {
            return g-1 <= b && b <= 4 + 2*(g-1);
        }

        public static void Main()
        {
            int[] xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));
            int[] ys = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));
            Console.WriteLine(ok(xs[0], ys[1]) || ok(xs[1], ys[0]) ? "YES" : "NO");
        }
    }
}


using System;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;

namespace ConsoleApplication1
{
    class Program
    {
        static class Scanner
        {
            readonly static IEnumerator<string> Tokens;
            static Scanner()
            {
                Tokens = Enumerable.Range(Int32.MinValue, Int32.MaxValue).
                    Select(s => Console.ReadLine()).
                    TakeWhile(s => s != null).
                    SelectMany(s => s.Split(new[] { ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries)).
                    Concat(Enumerable.Repeat(0, 1).Select(_ => (string)null)).
                    GetEnumerator();
            }

            public static string NextToken()
            {
                Tokens.MoveNext();
                return Tokens.Current;
            }
        }

        static int NextInt()
        {
            return int.Parse(Scanner.NextToken());
        }

        static long NextLong()
        {
            return long.Parse(Scanner.NextToken());
        }

        void Solve()
        {
            int n = NextInt(), x = NextInt(), y = NextInt();
            int dx = x - n/2, dy = y - n/2;
            Console.Write(!(dx > 1 || dx < 0 || dy > 1 || dy < 0) ? "NO" : "YES");
        }

        static void Main()
        {
#if MY_SUPER_PUPER_ONLINE_JUDGE
            string dir = Directory.GetCurrentDirectory();
            dir = Directory.GetParent(dir).FullName;
            dir = Directory.GetParent(dir).FullName;
            Console.SetIn(new StreamReader(dir + "\\input.txt"));
            Console.SetOut(new StreamWriter(dir + "\\output.txt"));
#endif
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            new Program().Solve();
#if MY_SUPER_PUPER_ONLINE_JUDGE
            Console.In.Close();
            Console.Out.Close();
#endif
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;

namespace CodeForces_85
{
    class prob_b
    {

        static void Main()
        {
            string[] tmp = Console.ReadLine().Split(" ".ToCharArray());
            int n = Int32.Parse(tmp[0]);
            int x = Int32.Parse(tmp[1]);
            int y = Int32.Parse(tmp[2]);

            if (x >= n / 2 && x <= n / 2 + 1 && y >= n / 2 && y <= n / 2 + 1)
                Console.WriteLine("NO");
            else Console.WriteLine("YES");

        }

    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private long N, S;
    private void Scan()
    {
        var line = Console.ReadLine().Split(' ');
        N = long.Parse(line[0]);
        S = long.Parse(line[1]);
    }

    public long C(long n)
    {
        int sum = 0;
        long p = n;
        while (p > 0)
        {
            sum += (int)(p % 10);
            p /= 10;
        }
        return n - sum;
    }

    public void Solve()
    {
        Scan();
        long ok = long.MaxValue;
        long ng = 0;
        while (ok - ng > 1)
        {
            long mid = (ok + ng) / 2;
            if (C(mid) >= S)
            {
                ok = mid;
            }
            else
            {
                ng = mid;
            }
        }
        Console.WriteLine(Math.Max(0, N - ok + 1));
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Codeforces
{

    public class C
    {

        public static void Main(string[] args)
        {
          string[] token = Console.ReadLine().Split();

          long n  = long.Parse(token[0]);
          long s =  long.Parse(token[1]);

          //int cnt = 0;
          long nNine = s;
          long minBest = 0;
          while(true){
            long nn = SumN(nNine);
            if(nn>=s){
              minBest = nNine;
              break;
            }
            nNine++;
          }

          long ans = n - minBest +1;

          if(ans<0)ans =0;

           Console.WriteLine(ans);
        }

        static long SumN(long n){
          string aa = n.ToString();
          int sum = 0;
          for(int i=0;i<aa.Length;i++){
            sum += int.Parse(aa[i].ToString());
          }

          long Nc = n - sum;
          return Nc;
        }
    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
   class B
   {
      static void Main(string[] args)
      {
        int n = int.Parse(Console.ReadLine());

        long ans = 0;

        for(int x=n;x>=1;x--){
          for(int y=x;y>=1;y--){
            int c = x^y;
            if(c<=n && c>=x && c != x+y){
              ans++;
            }

          }
        }

        Console.WriteLine(ans);
      }
   }

}


using System;

namespace Xorygol
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            int n = Convert.ToInt32(Console.ReadLine());
            for (int a = 1; a <= n; a++)
            {
                for (int b = a; b <= n; b++)
                {
                    int c = a ^ b;
                    if((b + a > c) && (a + c > b) && (c + b > a) && (c >= b) && (c <= n))
                    {
                        count++;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.IO;

namespace С1
{
    class Program
    {
        static bool isFileIO = false;

        static string[] lines;
        static int pointer = 0;

        static void Main(string[] args)
        {
            if (isFileIO)
            {
                lines = File.ReadAllLines("input.txt");
            }
            ClearFile();
            Solve();
        }

        static string ReadLine()
        {
            if (isFileIO)
            {
                return lines[pointer++];
            }
            else
            {
                return Console.ReadLine();
            }
        }

        static void ClearFile()
        {
            File.WriteAllText("output.txt", "");
        }

        static void WriteLine(string str)
        {
            if (isFileIO)
            {
                File.AppendAllText("output.txt", str + "\n");
            }
            else
            {
                Console.WriteLine(str);
            }
        }

        static void Solve()
        {
            long w;
            long m;
            long k;

            string[] s = Console.ReadLine().Split(' ');
            w = long.Parse(s[0]);
            m = long.Parse(s[1]);
            k = long.Parse(s[2]);

            long balls = w / k;
            //Console.WriteLine(naive(balls, m));
            Console.WriteLine(real(balls, m));
        }

        static long summ(long a)
        {
            string s = a + "";
            return s.Length;
        }

        static long real(long balls, long m)
        {
            int n = 18;
            long first = summ(m);
            long sec = 0;
            for (long i = 1; i < n; i++)
            {
                long power = (long)Math.Pow(10, i);
                if(power >= m)
                {
                    sec = i;
                    break;
                }
            }

            List<long> longs = new List<long>();
            longs.Add(m);
            for (long i = sec; i < n; i++)
            {
                longs.Add((long)Math.Pow(10, i));
            }

            for (int i = 0; i < longs.Count; i++ )
            {
                //Console.WriteLine(longs[i]);
            }

            List<long> dl = new List<long>();

            List<long> points = new List<long>();
            long portion = first * ((long)Math.Pow(10, sec)-m);
            points.Add(portion);
            dl.Add(sec);
            for (long i = sec + 1; i < n; i++)
            {
                points.Add(i * ((long)Math.Pow(10, i) - (long)Math.Pow(10, i-1)));
                dl.Add(i);
            }

            for (int i = 0; i < points.Count; i++)
            {
                //Console.WriteLine(points[i]);
            }

            long total = 0;
            for (int i = 0; i < points.Count; i++ )
            {
                if (balls >= points[i])
                {
                    total += points[i]/dl[i];
                    balls -= points[i];
                }
                else
                {
                    long diff = balls / dl[i];
                    total += diff;
                    balls -= diff * dl[i];
                }
            }

            //Console.WriteLine(total);

            return total;
        }

        static long naive(long balls, long m)
        {
            long total = 0;
            long i = m;
            long c = 0;
            while(total<balls)
            {
                if (total + summ(i) <= balls)
                {
                    total += summ(i);
                    Console.WriteLine(i + " " + summ(i));
                    i++;
                    c++;
                }
                else
                {
                    break;
                }
            }
            return c;
        }

    }

}

/*
1 1
#
1
1 1
*/


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _373_B
{
    class Program
    {
        static void Main(string[] args)
        {

            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long w = input[0];
            long m = input[1];
            long k = input[2];

            long overallCount = 0;
            long cost = 0;
            long current = m;

            while (cost < w)
            {
                int unitLength = current.ToString().Count();
                long unitCost = ((long)unitLength) * k;
                var biggest = long.Parse(new string('9', unitLength));
                long count = biggest - current + 1;
                long currentCost = 0;
                bool overflow = false;
                try
                {
                    currentCost = checked(count * unitCost);
                }
                catch
                {
                    overflow = true;
                }
                if (!overflow && cost + currentCost <= w)
                {
                    cost += currentCost;
                    overallCount += count;
                    current = biggest + 1;
                }
                else
                {
                    long countmin = (w - cost) / unitCost;
                    overallCount += countmin;
                    Console.WriteLine(overallCount);
                    return;
                }
            }
            Console.WriteLine(overallCount);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Generic
{
    class Program
    {
        static void Main(string[] args)
        {

            var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var n = input[0];
            var m = input[1];
            var k = input[2];

            if (k + 2 > n + m)
            {
                Console.WriteLine(-1);
            }
            else
            {
                var r1 = Math.Min(m, k + 1);
                var r2 = Math.Min(n, k + 1);
                var res1 = (m / r1) * (n / (k+2 - r1));
                var res2 = (n / r2) * (m / (k+2 - r2));
                Console.WriteLine(Math.Max(res1, res2));
            }

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jzzhu_and_Chocolate
{
    class Program
    {
        static IO io = new IO();
        static void Main(string[] args)
        {
            long num_H = io.ReadNextLong();
            long num_W = io.ReadNextLong();
            int num_K = io.ReadNextInt();
            if (num_H + num_W - 2 < num_K)
            {
                io.PutStr(-1);
            }
            else
            {
                long num_Max = -1;
                long num_Min = Math.Min(num_H - 1, num_K);
                long num_Count = num_K - num_Min;
                num_Max = Math.Max((num_H/(num_Min+1))*num_W/(num_Count+1),num_Max);
                num_Min= Math.Min((num_W-1),num_K);
                num_Count=num_K-num_Min;
                num_Max=Math.Max(num_H/(num_Count+1)*(num_W/(num_Min+1)),num_Max);
                io.PutStr(num_Max);
                io.ReadNum();
            }
        }
    }

    class IO
    {
        private static Queue<string> currentLineTokens = new Queue<string>();
        private static string[] ReadAndSplitLine()
        {
            return Console.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }
        public int ReadNextInt()
        {
            return int.Parse(ReadToken());
        }
        public long ReadNextLong()
        {
            return long.Parse(ReadToken());
        }

        public int ReadNum()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
        public long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }
        public string ReadStr()
        {
            return Console.ReadLine();
        }
        public string[] ReadStrArr()
        {
            return Console.ReadLine().Split(' ');
        }
        public int[] ReadIntArr()
        {
            return Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), s => int.Parse(s));
        }
        public void PutStr(string str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(int str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(long str)
        {
            Console.WriteLine(str);
        }

        public static string ReadToken()
        {
            while (currentLineTokens.Count == 0)
                currentLineTokens = new Queue<string>(ReadAndSplitLine());
            return currentLineTokens.Dequeue();
        }
    }
}


/*
 * Created by SharpDevelop.
 * User: tagirov2
 * Date: 29.02.2016
 * Time: 09:56
 *

A. �������
����������� �� ������� �� ����   2 �������
����������� �� ������ �� ����   256 ��������
����   ����������� ����
�����   ����������� �����
����� ������������ ��������� �������������� ��������. ������ �������� ������������ ������������ ����� ��������� ������������� r???c.
� ������ ������ ��������� �������, �� ����������� n ������ � ����������.
����� ����� �������� �����, ������� �� ����� ������� ����������, �� ������� ����� ��� ������� k ���������.
����� ����� ���������������� ��������� ������������� �� ���������, ������������� ���� ���������. ����������, ������� ��������� ���������� ���������� �� ����� �������.
��� ���������� ��������� ����������, ���� ���������� ���������� ��������������� ���������������.
������� ������
� ������ ������ ������� ������ �������� ������ ����� ����� r, c, n, k (1 <= r,?c,?n <= 10, 1 <= k <= n) � ���������� ����� � �������� � ��������������,
����������� ������ �������� ������������, ����� ���������� ��������� � ����������� ���������� ���������, ������� ������ �������������� �� ���������� �����, ��������������.
� ��������� n ������� �������� �� ��� ����� ����� xi � yi (1 <= xi <= r, 1 <= yi <= c) � ����� ������ � ����� �������, ������������ ������� i-�� ��������, ��������������.
�������������, ��� ������� ���� ��������� ��������.
�������� ������
�������� ����������� ����� ����� � ���������� ��������� ����������, �� ������� ����� ���� �� k ���������.
�������
������� ������
2 2 1 1
1 2
�������� ������
4
������� ������
3 2 3 3
1 1
3 1
2 2
�������� ������
1
������� ������
3 2 3 2
1 1
3 1
2 2
�������� ������
4
����������
����� ������������ �*� ��� ����������� ��������� � �#� ��� ���������.
� ������ ������� ������� �������� ��������� �������:
*#
**
����� ����� ������� ����������, ���������� ������ ��������, ������������� 1???2, ���������� ���� ������� � ���������,
2???1 ������� � ��������� ��� ���������������� ����� ��� ������ �������� ������������. ����� �������, �������� 4 ����������.
�� ������ ������� ������� �������� ��������� �������:
#*
*#
#*
����� ������� ������ ���������� ����� ��������.
� ������� ������� ������� �������� ��� ��, ��� � �� ������.

 */

using System;

class Program
{
	public static void Main(string[] args)
	{
		string ss = Console.ReadLine ();
		string [] s = ss.Split (' ');
		int r = int.Parse (s [0]);
		int c = int.Parse (s [1]);
		int n = int.Parse (s [2]);
		int k = int.Parse (s [3]);
		int [,] a = new int [r, c];

		for ( int i=0; i < n; i++ )
		{
			ss = Console.ReadLine ();
			string [] sa = ss.Split (' ');
			int x = int.Parse (sa [0]);
			int y = int.Parse (sa [1]);
			a [x-1, y-1] = 1;
		}

		int m = 0;
		for ( int i=0; i < r; i++ )
			for ( int j=0; j < c; j++ )
				for ( int t=i; t < r; t++ )
					for ( int p=j; p < c; p++ )
					{
						int kol = 0;
						for ( int ii=i; ii <= t; ii++ )
							for ( int jj=j; jj <= p; jj++ )
								if ( a [ii, jj] == 1 )
									kol++;
						if ( kol >= k )
							m++;
					}

		Console.WriteLine (m);
//		Console.ReadKey(true);
	}
}


using System;
using System.IO;
using System.Text;

namespace Orchestra
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int r = Next(), c = Next(), n = Next(), k = Next();

            var nn = new int[r + 1,c + 1];
            for (int i = 0; i < n; i++)
            {
                int x = Next();
                int y = Next();
                nn[x, y] = 1;
            }
            var sum = new int[r + 1,c + 1];
            for (int i = 1; i <= r; i++)
            {
                for (int j = 1; j <= c; j++)
                {
                    sum[i, j] = nn[i, j] + sum[i - 1, j] + sum[i, j - 1] - sum[i - 1, j - 1];
                }
            }
            int count = 0;

            for (int i = 1; i <= r; i++)
            {
                for (int j = 1; j <= c; j++)
                {
                    if (sum[i, j] < k)
                        continue;
                    for (int l = 0; l < i; l++)
                    {
                        int delta = sum[i, j] - sum[l, j];
                        if (delta < k)
                            break;

                        for (int m = 0; m < j; m++)
                        {
                            int d = delta + sum[l, m] - sum[i, m];
                            if (d >= k)
                                count++;
                        }
                    }
                }
            }

            writer.WriteLine(count);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
   class ADiv2
   {
      static void Main(string[] args)
      {
          string[] token  = Console.ReadLine().Split();
          int h = int.Parse(token[0])* 10 + 1;;
          int m = int.Parse(token[1])* 2 + 1;
          int s = int.Parse(token[2])* 2 + 1;
          int t1 = int.Parse(token[3]) *10;
          int t2 = int.Parse(token[4]) *10;

          int[] a = new int[5]{h,m,s,t1,t2};
          Array.Sort(a);
         for (int i = 0; i < a.Length; ++i) {
                if (a[i] % 2 == 0 && a[(i + 1) % a.Length] % 2 == 0) {
                    Console.WriteLine("YES");
                    return;
                }
          }
          Console.WriteLine("NO");

      }
   }

}


using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ');
            List<double> l = new List<double>();
            List<double> ll = new List<double>();
            foreach (var b in a)
            {
                var c = double.Parse(b);
                l.Add(c);
            }
            l[0] = (l[0] == 12 ? 0d : l[0] + l[1] / 60d + l[2] / 3600d) * 5;
            l[1] = l[1] + l[2] / 60;
            var t1 = l[3] * 5;
            var t2 = l[4] * 5;
            for(int i = 0; i < 3; i++)
            {
                ll.Add(l[i]);
            }
            ll.Sort();

            var llmx = ll.Max();
            var llmn = ll.Min();
            if (llmx < t1 && llmx < t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (llmn > t1 && llmn > t2)
            {

                Console.WriteLine("YES");
                return;
            }

            //

            if (ll[0] < t1 && ll[1] > t1 && ll[0] < t2 && ll[1] > t2)
            {

                Console.WriteLine("YES");
                return;
            }
            if (ll[1] < t1 && ll[2] > t1 && ll[1] < t2 && ll[2] > t2)
            {

                Console.WriteLine("YES");
                return;
            }
            //
            if (t1 > t2)
            {
                Swap(ref t1,ref t2);
            }
            if (t2 > llmx && t1 < llmn)
            {

                Console.WriteLine("YES");
                return;
            }
            Console.WriteLine("NO");

            }
        public static void Swap<T>(ref T lhs, ref T rhs)
        {
            T temp = lhs;
            lhs = rhs;
            rhs = temp;
        }
    }
}


using System;
using System.Collections.Generic;

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Codeforces
{
    public class Input
    {
        private static string _line;

        public static bool Next()
        {
            _line = Console.ReadLine();
            return !string.IsNullOrEmpty(_line);
        }

        public static bool Next(out long a)
        {
            var ok = Next();
            a = ok ? long.Parse(_line) : 0;
            return ok;
        }

        public static bool Next(out long a, out long b)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
            }
            else
            {
                a = b = 0;
            }

            return ok;
        }

        public static bool Next(out long a, out long b, out long c)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
            }
            else
            {
                a = b = c = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
            }
            else
            {
                a = b = c = d = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d, out long e)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
            }
            else
            {
                a = b = c = d = e = 0;
            }
            return ok;
        }

        public static List<long> Numbers()
        {
            return !Next() ? new List<long>() : _line.Split(' ').Select(long.Parse).ToList();
        }

        public static bool Next(out string value)
        {
            value = string.Empty;
            if (!Next()) return false;
            value = _line;
            return true;
        }
    }

    public class DisjointSet
    {
        private readonly int[] _parent;
        private readonly int[] _rank;
        public int Count { get; private set; }

        public DisjointSet(int count, int initialize = 0)
        {
            Count = count;
            _parent = new int[Count];
            _rank = new int[Count];
            for (var i = 0; i < initialize; i++) _parent[i] = i;
        }

        private DisjointSet(int count, int[] parent, int[] rank)
        {
            Count = count;
            _parent = parent;
            _rank = rank;
        }

        public void Add(int v)
        {
            _parent[v] = v;
            _rank[v] = 0;
        }

        public int Find_Recursive(int v)
        {
            if (_parent[v] == v) return v;
            return _parent[v] = Find(_parent[v]);
        }

        public int Find(int v)
        {
            if (_parent[v] == v) return v;
            var last = v;
            while (_parent[last] != last) last = _parent[last];
            while (_parent[v] != v)
            {
                var t = _parent[v];
                _parent[v] = last;
                v = t;
            }
            return last;
        }

        public int this[int v]
        {
            get { return Find(v); }
            set { Union(v, value); }
        }

        public void Union(int a, int b)
        {
            a = Find(a);
            b = Find(b);
            if (a == b) return;
            if (_rank[a] < _rank[b])
            {
                var t = _rank[a];
                _rank[a] = _rank[b];
                _rank[b] = t;
            }
            _parent[b] = a;
            if (_rank[a] == _rank[b]) _rank[a]++;
        }

        public int GetSetCount()
        {
            var result = 0;
            for (var i = 0; i < Count; i++)
            {
                if (_parent[i] == i) result++;
            }
            return result;
        }

        public DisjointSet Clone()
        {
            var rank = new int[Count];
            _rank.CopyTo(rank, 0);
            var parent = new int[Count];
            _parent.CopyTo(parent, 0);
            return new DisjointSet(Count, parent, rank);
        }

        public override string ToString()
        {
            return string.Join(",", _parent.Take(50));
        }
    }

    public class Matrix
    {
        public static Matrix Create(int i, int j)
        {
            var m = new Matrix(i, j);
            return m;
        }

        public static Matrix Create(int i)
        {
            var m = new Matrix(i, i);
            return m;
        }

        public long Modulo { get; set; }

        private readonly int _width;
        private readonly int _height;
        private readonly long[,] _data;
        public int Width{get { return _width; }}
        public int Height{get { return _height; }}

        private Matrix(int i, int j)
        {
            Modulo = 1000000000000000000L;
            _width = j;
            _height = i;
            _data = new long[_height, _width];
        }

        public static Matrix operator *(Matrix m1, Matrix m2)
        {
            if (m1.Width != m2.Height) throw new InvalidDataException("m1.Width != m2.Height");
            var m = Create(m2.Width, m1.Height);
            m.Modulo = m1.Modulo;
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                {
                    for (var k = 0; k < m1.Width; k++)
                        m[j, i] += (m1[j, k]*m2[k, i]) % m1.Modulo;
                    m[j, i] %= m1.Modulo;
                }
            return m;
        }

        public static Matrix operator +(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator -(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator *(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i=0;i<m1.Width;i++)
                for (var j=0;j<m1.Height;j++)
                        m[j, i] = (m[j, i] * l) % m.Modulo;
            return m;
        }

        public static Matrix operator *(long l, Matrix m1)
        {
            return m1*l;
        }

        public static Matrix operator +(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i = 0; i < m1.Width; i++)
                    m[i, i] = (m[i, i] + l) % m.Modulo;
            return m;
        }

        public static Matrix operator +(long l, Matrix m1)
        {
            return m1 + l;
        }

        public static Matrix operator -(Matrix m1, long l)
        {
            return m1 + (-l);
        }

        public static Matrix operator -(long l, Matrix m1)
        {
            var m = m1.Clone() * -1;
            return m + l;
        }

        public Matrix BinPower(long l)
        {
            var n = 1;
            var m = Clone();
            var result = new Matrix(m.Height, m.Width) + 1;
            result.Modulo = m.Modulo;
            while (l != 0)
            {
                var i = l & ~(l - 1);
                l -= i;
                while (n < i)
                {
                    m = m*m;
                    n <<= 1;
                }
                result *= m;
            }
            return result;
        }

        public void Fill(long l)
        {
            l %= Modulo;
            for (var i = 0; i < _height; i++)
                for (var j = 0; j < _width; j++)
                    _data[i, j] = l;
        }

        public Matrix Clone()
        {
            var m = new Matrix(_width, _height);
            Array.Copy(_data, m._data, _data.Length);
            m.Modulo = Modulo;
            return m;
        }

        public long this[int i, int j]
        {
            get { return _data[i, j]; }
            set { _data[i, j] = value % Modulo; }
        }
    }
}

namespace Codeforces.TaskE
{
    public class Task
    {
        public static void Main()
        {
            var task = new Task();
            try
            {
                task.Solve();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
                throw;
            }
        }

        bool Check(long b, long a)
        {
            if (a == 0) return false;
            if (!Check(a, b%a)) return true;
            var c = b/a;
            return c%(a+1)%2==0;
        }

        void Solve()
        {
            long t;
            Input.Next(out t);

            var l = new List<string>();
            for (var i = 0; i < t; i++)
            {
                long a, b;
                Input.Next(out a, out b);
                if (a < b)
                {
                    var c = b;
                    b = a;
                    a = c;
                }
                l.Add(Check(a,b) ? "First" : "Second");
            }
            Console.WriteLine(string.Join(Environment.NewLine, l));
        }
    }
}