Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode:


Partition(A, p, r)
1 x = A[r]
2 i = p-1
3 for j = p to r-1
4     do if A[j] <= x
5        then i = i+1
6            exchange A[i] and A[j]
7 exchange A[i+1] and A[r]
8 return i+1


Quicksort(A, p, r)
1 if p < r
2    then q = Partition(A, p, r)
3        run Quicksort(A, p, q-1)
4        run Quicksort(A, q+1, r)


Here, A is an array which represents a deck of cards and comparison operations are performed based on the numbers.

Your program should also report the stability of the output for the given input (instance). Here, 'stability of the output' means that: cards with the same value appear in the output in the same order as they do in the input (instance).

Constraints

* 1 ≤ n ≤ 100,000
* 1 ≤ the number of a card ≤ 109
* There are no identical card in the input

Input

The first line contains an integer n, the number of cards.

n cards are given in the following lines. Each card is given in a line and represented by a pair of a character and an integer separated by a single space.

Output

In the first line, print the stability ("Stable" or "Not stable") of this output.

In the following lines, print the arranged cards in the same manner of that of the input.

Examples

Input

6
D 3
H 2
D 1
S 3
D 2
C 1


Output

Not stable
D 1
C 1
D 2
H 2
D 3
S 3


Input

2
S 1
H 1


Output

Stable
S 1
H 1
import java.io.*;
import java.util.Arrays;

public class Main {

    class Card implements Comparable<Card> {
        public final String suit;
        public final int number;
        public final int id;

        public Card(String suit, int number, int id) {
            this.suit = suit;
            this.number = number;
            this.id = id;
        }

        @Override
        public int compareTo(Card card) {
            if (this.number < card.number) return -1;
            if (this.number > card.number) return 1;
            return 0;
        }

        @Override
        public String toString() {
            return this.suit + " " + String.valueOf(this.number);
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == this) return true;
            if (!(obj instanceof Card)) return false;
            Card c = (Card) obj;
            return this.suit.equals(c.suit) && this.number == c.number;
        }
    }

    void solve() {
        int n = io.nextInt();
        Card[] A = new Card[n];
        for (int i = 0; i < n; i++) {
            String suit = io.next();
            int number = io.nextInt();
            A[i] = new Card(suit, number, i);
        }

        Card[] B = A.clone();
        quickSort(A, 0, A.length - 1);
        boolean isStable = true;
        for (int i = 1; i < A.length - 1; i++) {
            if (A[i - 1].number == A[i].number && A[i - 1].id > A[i].id) {
                isStable = false;
                break;
            }
        }
        System.out.println(isStable ? "Stable" : "Not stable");
        for (Card a : A) {
            System.out.println(a.toString());
        }
    }

    int partition(Card[] A, int p, int r) {
        Card x = A[r];
        int i = p - 1;
        for (int j = p; j < r; j++) {
            if (x.compareTo(A[j]) >= 0) {
                i += 1;
                swap(A, i, j);
            }
        }
        swap(A, i + 1, r);
        return i + 1;
    }

    void quickSort(Card[] A, int p, int r) {
        if (p < r) {
            int q = partition(A, p, r);
            quickSort(A, p, q - 1);
            quickSort(A, q + 1, r);
        }
    }

    void bubbleSort(Card[] c) {
        int n = c.length;
        for (int i = 0; i < n; i++)
            for (int j = n - 1; j > i; j--) {
                if (c[j - 1].compareTo(c[j]) > 0) {
                    Card tmp = c[j - 1];
                    c[j - 1] = c[j];
                    c[j] = tmp;
                }
            }
    }

    void swap(Card[] A, int idx1, int idx2) {
        Card tmp = A[idx1];
        A[idx1] = A[idx2];
        A[idx2] = tmp;
    }

    public static void main(final String[] args) {
        new Main().solve();
    }

    IO io = new IO();

    class IO {
        private final int SIZE = 1 << 12;
        private final InputStream stream = System.in;
        private final byte[] buffer = new byte[SIZE];
        private int ptr = 0, buffLen = 0;

        private boolean hasNextByte() {
            if (ptr < buffLen) return true;
            ptr = 0;
            try {
                buffLen = stream.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return buffLen > 0;
        }

        private byte readByte() {
            if (hasNextByte()) return buffer[ptr++];
            return -1;
        }

        private boolean isAscii(byte i) {
            return '!' <= i && i <= '~';
        }

        public char nextChar() {
            byte b = readByte();
            while (!isAscii(b)) b = readByte();
            return (char) b;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();
            byte b = readByte();
            while (isAscii(b)) {
                sb.append((char) b);
                b = readByte();
            }
            return sb.toString();
        }

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

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

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

