#include <iostream> 
#include <string> 

int main(){
  std::string sent;
  int gyou,num=0;
  std::cin >> gyou;
  getline(std::cin, sent);
  for(int i=0;i<gyou;++i){
    num=0;
    getline(std::cin, sent);
    std::string bef="Hoshino",aft="Hoshina";
    while(num!=-1){
      num=(int)(sent.find(bef));
      if(num!=-1){
      sent.replace(num,bef.size(),aft);
      }
    }
    std::cout << sent << std::endl;
    /*if(i<gyou-1)
    std::cout << std::endl;*/
  }
  return 0; 
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
 
int  main(){
string s;
cin >> s;
int n;
cin >> n;
for(int i=0;i<s.size();i+=n){
    cout<<s.at(i);
}
cout<<endl;
}
 
