1 #include<iostream>
2 #include<cstdio>
3 #include<cstdlib>
4 #include<cstring>
5 #include<string>
6 #include<cmath>
7 #include<vector>
8 #include<algorithm>
9 #include<queue>
10 #include<map>
11 using namespace std;
12 #define Max 1e9
13 long long n,gs=0,dis=1e9,ans=0;
14 long long a[3000],b[3000],vis[100005],sv[3000][2];
15 long long sum[100005],dx[3000],dy[100005],cx[3000],cy[100005];
16 map<long long,int> pd;
17 int bfs()
18 {
19 queue<long long> q;
20 dis=Max;
21 memset(dx,0,sizeof(dx));
22 memset(dy,0,sizeof(dy));
23 for (int i=1;i<=n;i++)
24 {
25 if (!cx[i]) q.push(i);
26 }
27 while (!q.empty())
28 {
29 long long x=q.front();
30 q.pop();
31 if (dx[x]>dis) break;
32 for (int i=1;i<=gs;i++)
33 {
34 if (!dy[i]&&(a[x]+b[x]==sum[i]||a[x]-b[x]==sum[i]||a[x]*b[x]==sum[i]))
35 {
36 dy[i]=dx[x]+1;
37 if (!cy[i]) dis=dy[i];
38 else
39 {
40 dx[cy[i]]=dy[i]+1;
41 q.push(cy[i]);
42 }
43 }
44 }
45 }
46 return dis!=Max;
47 }
48 int find(long long x)
49 {
50 for (int i=1;i<=gs;i++)
51 {
52 if (!vis[i]&&(a[x]+b[x]==sum[i]||a[x]-b[x]==sum[i]||a[x]*b[x]==sum[i])&&dy[i]==dx[x]+1)
53 {
54 vis[i]=1;
55 if (cy[i]&&dy[i]==dis) continue;
56 if (!cy[i]||find(cy[i]))
57 {
58 cx[x]=i;cy[i]=x;
59 return 1;
60 }
61 }
62 }
63 return 0;
64 }
65 int main()
66 {
67 scanf("%lld",&n);
68 for (int i=1;i<=n;i++)
69 {
70 scanf("%lld%lld",&a[i],&b[i]);
71 long long x=a[i]+b[i];
72 if (!pd[x])
73 sum[++gs]=x,pd[x]=1;
74 x=a[i]-b[i];
75 if (!pd[x])
76 sum[++gs]=x,pd[x]=1;
77 x=a[i]*b[i];
78 if (!pd[x])
79 sum[++gs]=x,pd[x]=1;
80 }
81 while (bfs())
82 {
83 memset(vis,0,sizeof(vis));
84 for (int i=1;i<=n;i++)
85 {
86 if (!cx[i])
87 {
88 ans+=find(i);
89 }
90 }
91 }
92 if (ans!=n)
93 {printf("impossible");return 0;}
94 else
95 {
96 for (int i=1;i<=n;i++)
97 {
98 if (a[i]+b[i]==sum[cx[i]])
99 printf("%lld + %lld = %lld\n",a[i],b[i],sum[cx[i]]);
100 else if (a[i]-b[i]==sum[cx[i]])
101 printf("%lld - %lld = %lld\n",a[i],b[i],sum[cx[i]]);
102 else if (a[i]*b[i]==sum[cx[i]])
103 printf("%lld * %lld = %lld\n",a[i],b[i],sum[cx[i]]);
104 }
105 }
106 }