Alyona's mother wants to present an array of n non-negative integers to Alyona. The array should be special. 

Alyona is a capricious girl so after she gets the array, she inspects m of its subarrays. Subarray is a set of some subsequent elements of the array. The i-th subarray is described with two integers li and ri, and its elements are a[li], a[li + 1], ..., a[ri].

Alyona is going to find mex for each of the chosen subarrays. Among these m mexes the girl is going to find the smallest. She wants this minimum mex to be as large as possible. 

You are to find an array a of n elements so that the minimum mex among those chosen by Alyona subarrays is as large as possible.

The mex of a set S is a minimum possible non-negative integer that is not in S.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 105).

The next m lines contain information about the subarrays chosen by Alyona. The i-th of these lines contains two integers li and ri (1 ≤ li ≤ ri ≤ n), that describe the subarray a[li], a[li + 1], ..., a[ri].

Output

In the first line print single integer — the maximum possible minimum mex.

In the second line print n integers — the array a. All the elements in a should be between 0 and 109.

It is guaranteed that there is an optimal answer in which all the elements in a are between 0 and 109.

If there are multiple solutions, print any of them.

Examples

Input

5 3
1 3
2 5
4 5


Output

2
1 0 2 1 0


Input

4 2
1 4
2 4


Output

3
5 2 0 1

Note

The first example: the mex of the subarray (1, 3) is equal to 3, the mex of the subarray (2, 5) is equal to 3, the mex of the subarray (4, 5) is equal to 2 as well, thus the minumal mex among the subarrays chosen by Alyona is equal to 2.
import java.io.*;
import java.util.*; // тут лежат все коллекции, Random

// имя начинается с двух подчеркиваний, чтобы был первым в списке (он сортится по алфавиту)
public class Registration {

	// определяет, запускается решение "дома" или на CF/timus
	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	public static int maxArray(int[] a) {
		int Max = -1;
		for (int i = 0; i < a.length; i++) {
			if (Max < a[i]) {
				Max = a[i];
			}
		}
		return Max;

	}

	public static int nubmMaxArray(int[] a) {
		int Number = 0;
		int Max = -1;
		for (int i = 0; i < a.length; i++) {
			if (Max < a[i]) {
				Max = a[i];
				Number = i + 1;
			}
		}
		return Number;
	}

	public static int maxGzNumb(int[] a) {
		int[] b = new int[maxArray(a) + 1];
		for (int u = 0; u < a.length; u++) {
			b[a[u]]++;
		}
		return nubmMaxArray(b) - 1;
	}

	public static int bp(int[] a, int x) {
		int l = 0;
		int r = a.length - 1;
		while (l <= r) {
			int m = (l + r) / 2;
			if (a[m] == x) {
				return m;
			}
			if (a[m] < x) {
				l = m + 1;
			} else {
				r = m;
			}

		}
		return -1;

	}

	public boolean equals(String str1, String str2) {
		return str1 == null ? str2 == null : str1.equals(str2);
	}

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

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	void init() throws FileNotFoundException {
		// иницилизация потоков вводилок/выводилок
		// System.in/System.out - стандартные потоки ввода/вывода на консоль

		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}

		tok = new StringTokenizer("");
	}

	void run() {
		try {
			long timeStart = System.currentTimeMillis();

			init();
			solve();

			out.close();

			long timeEnd = System.currentTimeMillis();
			System.err.println("Time = " + (timeEnd - timeStart));
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	// чтение строки вернет null, если ничего не осталось
	String readLine() throws IOException {
		return in.readLine();
	}

	// содержит символы, являющиеся "разделителями ввода"
	// по умолчанию это пробел (перевод строки автоматом учитывается)
	String delimiter = " ";

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	void solve() throws IOException {
		int n = readInt();
		int m = readInt();
		int[] o = new int[n];
		int[][] w = new int[m][2];
		int c = 0;
		int mex = n + n;
		int p = 0;
		for (int i = 0; i < m; i++) {
			w[i][0] = readInt();
			w[i][1] = readInt();
			if (mex > w[i][1] - w[i][0]) {
				mex = w[i][1] - w[i][0];
			}
		}
		
		mex++;
		out.println(mex);
		for (int i = 0; i < n; i++) {
			out.print(i%mex);
			out.print(" ");
		}
	}
}