{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"正如前文所说,eroengine突然喜爱上了质数,他对质数的爱已经到了魔怔的地步。现在他想到了一个小游戏,首先随机挑选两个四位的素数a,b。\u003cbr\u003e\n游戏规则是:a可以通过改变某一位上的数字使其变成c,但只有当c也是四位的素数时才能进行这种改变。\u003cbr\u003e\neroengine只擅长抛出问题而不擅长解决问题,但他觉得你一定可以很轻松的算出a最少经过多少次变化使其变为b。\u003cbr\u003e\n例如:1033 -\u003e 8179 \u003cbr\u003e\n1033 \u003cbr\u003e\n1733 \u003cbr\u003e\n3733 \u003cbr\u003e\n3739 \u003cbr\u003e\n3779 \u003cbr\u003e\n8779 \u003cbr\u003e\n8179\u003cbr\u003e\n最少变换了6次。\u003cbr\u003e\n考虑为poj 有些比较新的用法可能无法使用,请注意"}},{"title":"Input","value":{"format":"HTML","content":"第一行输入整数T,表示样例数。 (T \u003c\u003d 100) \u003cbr\u003e\n每个样例输入两个四位的素数a,b。(没有前导零) \u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"对于每个样例,输出最少变换次数,如果无法变换成b则输出\"Impossible\"。"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e3\n1033 8179\n1373 8017\n1033 1033\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e6\n7\n0\u003c/pre\u003e"}}]}