#include<iostream>
using namespace std;

int main() {
    string code;
    cin >> code;
    
    try {
        if(code.length()!=14)
           throw 1;
        for(int i=0;i<14;i++) {
            if(i==4 || i==9) {
                if(code[i]!='-')
                throw 1;
            }
            else {
                if(!(code[i] >='A' && code[i]<='Z') || (code[i]>='O' && code[i] <='9')))
                throw 1;
            }
        }
        cout << "Valid";
    }
    catch(...) {
        cout <<"Invalid";
    }
    return 0;
}