import std.stdio;void main(){for(string s=readln,t;t=readln,t;)t.dup.sort==s.sort&&write(t);}