#include<iostream>
#include<string>
using namespace std;

void validateGiftCard(string code) {
    if (code.length() != 14) {
        throw "Invalid";
    }
    
    if (code[4] != ' - ' || code [9] != ' - ') {
        throw"Invalid";
    }
    
    for(int i=0; i < 14; i++) {
        if (i == 4 || i ==9) continue;
        
        char c = code[i];
        if (!((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))) {
            throw "Invalid";
        }
    }
}

int main() {
    string code;
    cin >> code;
    
    try {
        validateGiftCard(code);
        cout << "Valid" << endl;
    }
    catch (const char* msg) {
        cout << msg << endl;
        
    }
    
    return 0;
}