{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"hh学长酷爱素数,他经常自娱自乐,随机挑选两个四位的素数a,b。\u003cbr\u003e\n游戏规则是:a可以通过改变某一位上的数字使其变成c,但只有当c也是四位的素数时才能进行这种改变。\u003cbr\u003e\nhh学长可以很轻松的算出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"}},{"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"}}]}