using System;

class Program {
    static void Main(string[] args) {
     int N = 0;
     int O = 0;
     int B = 0;
     int A = 0;
     int stanje = 0;
     int AB = 0;
     int Op = 0;
     int Bp = 0;
     int Ap = 0;
     int ABp = 0;
     int[] On = new int[4];
     int[] An = new int[4];
     int[] Bn = new int[4];
     int[] ABn = new int[4];
     string[] unoskrv = new string[4];
     unoskrv = Console.ReadLine().Split(' ');
     O = int.Parse(unoskrv[0]);
     A = int.Parse(unoskrv[1]);
     B = int.Parse(unoskrv[2]);
     AB = int.Parse(unoskrv[3]);
     string[] unos = new string[2];
     N = int.Parse(Console.ReadLine());
     for(int i = 0;i<N;i++){
      unos = Console.ReadLine().Split(' ');
       if(unos[0] == "O"){
         Op = int.Parse(unos[1]);
       }else if(unos[0] == "A"){
         Ap = int.Parse(unos[1]);
       }else if(unos[0] == "B"){
          Bp = int.Parse(unos[1]);
       }else{
        ABp = int.Parse(unos[1]);
       }
     }
   if(O < Op){
   Console.Write("nemoguce");
   }else{
    stanje += 1;
    O -= Op;
    On[0] = Op;

    if(A < Ap){
      Ap -= A;
      An[1] = A;
      A = 0;
      if(O < Ap){
       Console.Write("nemoguce");
      }else{
        O -= Ap;
        An[0] = Ap;
        stanje += 1;
      }
    }else{
      A -= Ap;
      An[1] = Ap;
      stanje += 1;
    }

    if(B < Bp){
      Bp -= B;
      Bn[2] = B;
      B = 0;
      if(O < Bp){
       Console.Write("nemoguce");
      }else{
        O -= Bp;
        Bn[0] = Bp;
        stanje += 1;
      }
    }else{
      B -= Bp;
      Bn[2] = Bp;
      stanje += 1;
    }
    AB += A+B+O;
    if(AB < ABp){
       Console.Write("nemoguce");
    }else{
      stanje += 1;
    }
   }
  if(stanje == 4){
   Console.Write("moguce");
  }
 }
}