#include <iostream>
#include <fstream>
#include <string>

using namespace std;

bool testprime(int number){
     int fc = 0;
     for (fc = 2; fc < number; ++fc){
         if (number % fc == 0)
            return false;
     }
     return true;
}

bool threeprime(int number){
     int fc, fc2;
     int factors = 0;
     for (fc = 2; fc < number; ++fc){
         if (testprime(fc) && number %fc == 0)
            factors++;
     }
     if (factors == 3){
        return true;
     }
     return false;
}

int main(){
    
    ofstream fout("out1.txt");
    ifstream fin ("data1.txt");    
    int input;
    int c = 0, c2 = 0;
    
    for (c = 0; c < 5; ++c){
        fin >> input;
        if (threeprime(input))
           fout << "valid\n";
        else
            fout<< "not\n";
    }
//    cin.get();
    
    return 0;
}

