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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;

class card implements Comparable{
  private char mark;
  private int number;

  public void markset(char thismark){
    mark = thismark;
  }
  public void numset(int thisnum){
    number = thisnum;
  }
  public char retmark(){
    return mark;
  }
  public int retnum(){
    return number;
  }

  public int compareTo(Object other){
    card othercard = (card)other;
    return number - othercard.retnum();
  }

  public void printcard(){
    System.out.print(mark);
    System.out.print(" ");
    System.out.println(number);    
  }

}

class cardwithind implements Comparable{
  private char mark;
  private int number;
  private int index;

  public void markset(char thismark){
    mark = thismark;
  }
  public void numset(int thisnum){
    number = thisnum;
  }
  public void indset(int thisind){
    index = thisind;
  }
  public char retmark(){
    return mark;
  }
  public int retnum(){
    return number;
  }
  public int retind(){
    return index;
  }

  public int compareTo(Object other){
    cardwithind othercard = (cardwithind)other;
    if(number != othercard.retnum()){
      return number - othercard.retnum();      
    }
    return index - othercard.retind();
  }

}

 
public class Main {
  private static int partition(card[] cardArray, int left, int right){
    card x = cardArray[right];
    int i = left - 1;
    for(int j = left; j < right; j++){
      if(cardArray[j].compareTo(x) <= 0){
        i++;
        card keep = cardArray[i];
        cardArray[i] = cardArray[j];
        cardArray[j] = keep;
      }
    }
    card keep2 = cardArray[i+1];
    cardArray[i+1] = cardArray[right];
    cardArray[right] = keep2;
    return i+1;
  }

  private static void quicksort(card[] cardArray, int left, int right){
    if(left < right){
      int q = partition(cardArray, left, right);
      quicksort(cardArray, left, q-1);
      quicksort(cardArray, q+1, right);
    }
  }

  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    card[] cards = new card[n];
    cardwithind[] cardswithind = new cardwithind[n];
    for(int i = 0; i < n; i++){
      char ch = sc.nextChar();
      int num = sc.nextInt();
      card newcard = new card();
      cardwithind newcardwithind = new cardwithind();
      newcard.markset(ch);
      newcard.numset(num);
      newcardwithind.markset(ch);
      newcardwithind.numset(num);
      newcardwithind.indset(i);
      cards[i] = newcard;
      cardswithind[i] = newcardwithind;
    }
    Arrays.sort(cardswithind);
    quicksort(cards, 0, n-1);
    boolean stablecheck = true;
    for(int i = 0; i < n; i++){
      if(cardswithind[i].retmark() != cards[i].retmark() || cardswithind[i].retnum() != cards[i].retnum()){
        stablecheck = false;
        break;
      }
    }
    System.out.println(stablecheck? "Stable" : "Not stable");
    for(int i = 0; i < n; i++){
      cards[i].printcard();
    }
  }
 
//nextChar を追加したよ！これをテンプレとして保存しよう！

// LinkedList<Integer>[] setsu = new LinkedList[n];
// for(int i = 0; i < n; i++){
//   setsu[i] = new LinkedList<Integer>();
// } 

 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }

      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }

      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}