var DataBase={"sprite":[{"name":"common","dataS":[{"name":"root","dataU":[{"pos":3,"name":"VAR","type":3000,"dir":15,"val":["this.a","[0,0,0]"]},{"pos":12,"name":"Start","type":3302,"dir":2,"val":[]},{"pos":13,"name":"IN[]","type":2102,"dir":2,"val":["this.a"," "]},{"pos":14,"name":"MTOI","type":3202,"dir":2,"val":["this.a"]},{"pos":15,"name":"SRT","type":1201,"dir":2,"val":["this.a"]},{"pos":16,"name":"MTOS","type":3206,"dir":2,"val":["this.a"]},{"pos":17,"name":"OUT[]","type":2304,"dir":0,"val":["this.a"," "]}]}]}]};
var flgCoder=false;
if (process.argv.length==2){
    flgCoder=true;
}

if(flgCoder){
  var fs = require('fs'),
	length = fs.fstatSync(process.stdin.fd).size,
	buffer = new Buffer(length),
	bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
  input = buffer.toString('utf8', 0, bytesRead);
  input=input.split('\n');
  var tnum=0;
} else{
	const rl=require("readline-sync");
	function readline(){
    str=rl.question();
    return str;
	};
}

function DataS(newdata){
  this.que=new Array();
  this.mark=new Array();
  this.mydataS =new Array(216);
  for(var i=0;i<216;++i){
    this.mydataS[i]={type:0,direct:0,val:[]};
  }

  for (var i in newdata['dataU']){
    let data=newdata['dataU'][i];
    let num=data['pos'];
    let newtype=parseInt(data['type']);
    this.mydataS[num].type = newtype;
    this.mydataS[num].direct=parseInt(data['dir']);
    this.mydataS[num].val=data['val'];
    switch(newtype){
      case  3101:   //mark
        mark.push({pos:num,name:data['val'][0]});
        break;
      case  3302:   //start
        this.que.push({from:num,to:num,tof:true,wait:0});
        break;
      case  3000:   //val
        eval(data['val'][0]+"="+data['val'][1]);
        break;
    }
  }
}
DataS.prototype={
  caldir:function(num){
    let div=[[0,5,0],[1,0,0],[0,1,0],[5,0,0],[0,0,1],[0,0,5]]
    let res=[-1,-1,-1,-1,-1,-1];
    for(let i=0;i<6;++i){
      let intD=(1<<i);
      if ((this.mydataS[num]['direct']&intD)==intD){
        res[i]=(((num%6)+div[i][0])%6)+((parseInt(num/6)%6+div[i][1])%6)*6+((parseInt(num/36)+div[i][2])%6)*36;
      }
    }
    return res;  
  },
  exe: function(){
    while(this.que.length>0){
      let d=this.que.shift();
      let to=d.to;
      let from=d.from;
      let tof=d.tof;
      let wait=d.wait;
      let dtype=this.mydataS[to]['type'];
      if(dtype==0){continue;};
      if((tof==false) && !(dtype==1302 ||(dtype==1))){continue;};
      if((tof==true) && (dtype==1302)){continue;};
      tof=this.exeDataU(to,tof);
      if (this.mydataS[to]['type']==1 ){
        if(wait==0) {
          wait=parseInt(this.mydataS[to]['val'][0]);
        }else{
          wait-=1;
        }
        if(wait>0){
          this.que.push({from:from,to:to,tof:tof,wait:wait});
          continue;
        }
      }
      let newdir=this.caldir(to);
      for(let i=0;i<6;++i){
        if ((newdir[i]>=0) && (newdir[i]!=from))this.que.push({from:to,to:newdir[i],tof:tof,wait:wait});
      }
    } 
  },
  exeDataU: function(pos,tof){
    let type=this.mydataS[pos].type;
    let val=this.mydataS[pos].val;
    switch(type){
      case 1000:
      case 1401:  //eval
        eval(val[0]);
        break;
      case 3000:
      case 2000:       //eval,LINE
        eval(val[0]+"="+val[1]);
        break;
      case 1201: //sort
        eval(val[0]+"="+val[0]+".sort(this.compareFunc)");
        break;
      case 1202: //rsort
        eval(val[0]+"="+val[0]+".sort(this.compareFuncR)");
        break;
      case 1301:
      case 1303:
      case 1304:       //f,for,while
        return eval(val[0]);
        break;
      case 1302:       //rev  
        tof=true;
        break; 
      case 2101:       //gets
        if(flgCoder){
          eval(val[0]+"=input["+tnum+"]");
          tnum++;
        } else{
          eval(val[0]+"= readline()");
        } 
        break;
      case 2102:       //in[]
        if(flgCoder){
          eval(val[0]+"=input["+tnum+"]");
          tnum++;
        } else{
          eval(val[0]+"= readline()");
        }
        eval(val[0]+" = "+val[0]+".split('"+val[1]+"')");
        break;
      case  2304:       //out[]
        eval("console.log("+val[0]+".join('"+val[1]+"'))");
        break;
      case 2302:
      case 2303:       //puts,print
        eval("console.log("+val[0]+")");
        break;
      case 3201: //toi
        eval(val[0]+"= parseInt("+val[0]+")");
        break;
      case 3203: //tos
        eval(val[0]+"= String("+val[0]+")")
        break;
      case 3205: //tof
        eval(val[0]+"= parseFloat("+val[0]+")")
        break;
      case 3202: //mtoi
        eval(val[0]+"= "+val[0]+".map(str => parseInt(str))")
        break;
      case 3204: //mtof
        eval(val[0]+"= "+val[0]+".map(str => parseFloat(str))")
        break;
      case 3206: //mtos
        eval(val[0]+"= "+val[0]+".map(str => String(str))")
        break;
      }
    return tof
  },
  compareFunc:function (a, b) {
    return a > b;
  },
  compareFuncR:function (a, b) {
    return  b > a;
  },
  getDataS: function(num){
    return this.mydataS[num];
  }

}

var ndataS=new DataS(DataBase['sprite'][0]['dataS'][0]);
ndataS.exe();



Measured memory_bytes: 15316