#include <iostream>
using namespace std;

int main() {
	string a;
	while(cin>>a){
		if(a=="I")cout<<"I ";
		if(a=="II")cout<<"II ";
		if(a=="III")cout<<"III ";
		if(a=="IIII")cout<<"IV "; // редкое но допустимое написание
		if(a=="IV")cout<<"IV ";
		if(a=="V")cout<<"V ";
	}
	// your code goes here
	return 0;
}