import java.util.*; public class Main { static final int MOD = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); long d = sc.nextLong(); int q = sc.nextInt(); TreeSet set = new TreeSet<>(); StringBuilder sb = new StringBuilder(); long max = 0; for (int i = 0; i < q; i++) { Work tmp = new Work(sc.nextLong(), sc.nextLong()); while (true) { Work before = set.floor(tmp); if (before == null || before.end < tmp.start - 1) { break; } tmp.add(before); set.remove(before); } while (true) { Work after = set.ceiling(tmp); if (after == null || tmp.end < after.start - 1) { break; } tmp.add(after); set.remove(after); } max = Math.max(max, tmp.getCount()); set.add(tmp); sb.append(max).append("\n"); } System.out.print(sb); } static class Work implements Comparable { long start; long end; public Work(long start, long end) { this.start = start; this.end = end; } public int compareTo(Work another) { if (start == another.start) { if (end == another.end) { return 0; } else if (end < another.end) { return -1; } else { return 1; } } else { if (start == another.start) { return 0; } else if (start < another.start) { return -1; } else { return 1; } } } public long getCount() { return end - start + 1; } public void add(Work another) { start = Math.min(start, another.start); end = Math.max(end, another.end); } public int hashCode() { return (int)start; } public boolean equals(Object o) { Work another = (Work) o; return start == another.start && end == another.end; } public String toString() { return "start:" + start + " end:" + end; } } }