There are n cities in Cyberland, numbered from 1 to n, connected by m bidirectional roads. The j-th road connects city aj and bj.

For tourists, souvenirs are sold in every city of Cyberland. In particular, city i sell it at a price of wi.

Now there are q queries for you to handle. There are two types of queries:

  * "C a w": The price in city a is changed to w.
  * "A a b": Now a tourist will travel from city a to b. He will choose a route, he also doesn't want to visit a city twice. He will buy souvenirs at the city where the souvenirs are the cheapest (possibly exactly at city a or b). You should output the minimum possible price that he can buy the souvenirs during his travel.



More formally, we can define routes as follow:

  * A route is a sequence of cities [x1, x2, ..., xk], where k is a certain positive integer.
  * For any 1 ≤ i < j ≤ k, xi ≠ xj.
  * For any 1 ≤ i < k, there is a road connecting xi and xi + 1.
  * The minimum price of the route is min(wx1, wx2, ..., wxk).
  * The required answer is the minimum value of the minimum prices of all valid routes from a to b.

Input

The first line of input contains three integers n, m, q (1 ≤ n, m, q ≤ 105), separated by a single space.

Next n lines contain integers wi (1 ≤ wi ≤ 109).

Next m lines contain pairs of space-separated integers aj and bj (1 ≤ aj, bj ≤ n, aj ≠ bj).

It is guaranteed that there is at most one road connecting the same pair of cities. There is always at least one valid route between any two cities.

Next q lines each describe a query. The format is "C a w" or "A a b" (1 ≤ a, b ≤ n, 1 ≤ w ≤ 109).

Output

For each query of type "A", output the corresponding answer.

Examples

Input

3 3 3
1
2
3
1 2
2 3
1 3
A 2 3
C 1 5
A 2 3


Output

1
2


Input

7 9 4
1
2
3
4
5
6
7
1 2
2 5
1 5
2 3
3 4
2 4
5 6
6 7
5 7
A 2 3
A 6 4
A 6 7
A 3 3


Output

2
1
5
3

Note

For the second sample, an optimal routes are:

From 2 to 3 it is [2, 3].

From 6 to 4 it is [6, 5, 1, 2, 4].

From 6 to 7 it is [6, 5, 7].

From 3 to 3 it is [3].

<image>
#include <bits/stdc++.h>
using namespace std;
int dfn[1000010], low[1000010], f[1000010], a[1000010], aa[1000010], cl,
    v1[1000010 * 4], nxt1[1000010 * 4], h1[1000010], e1, bc, v2[1000010 * 4],
    id[1000010], n, dep[1000010], nxt2[1000010 * 4], h2[1000010], e2,
    p[1000010], sz[1000010], w[1000010], mn[1000010], tp[1000010], ct;
multiset<int> ss[1000010];
void ad1(int x, int y) {
  v1[++e1] = y;
  nxt1[e1] = h1[x];
  h1[x] = e1;
}
void ad2(int x, int y) {
  v2[++e2] = y;
  nxt2[e2] = h2[x];
  h2[x] = e2;
}
stack<int> s;
void dfs(int x) {
  cl++;
  dfn[x] = low[x] = cl;
  s.push(x);
  for (int i = h1[x]; i; i = nxt1[i]) {
    if (!dfn[v1[i]]) {
      dfs(v1[i]);
      low[x] = min(low[x], low[v1[i]]);
      if (low[v1[i]] >= dfn[x]) {
        bc++;
        int z;
        do {
          z = s.top();
          s.pop();
          ad2(bc, z);
          ad2(z, bc);
        } while (!s.empty() && z != v1[i]);
        ad2(bc, x);
        ad2(x, bc);
      }
    } else
      low[x] = min(low[x], dfn[v1[i]]);
  }
}
void bd(int o, int l, int r) {
  if (l == r) {
    mn[o] = aa[l];
    return;
  }
  int md = (l + r) / 2;
  bd(o * 2, l, md);
  bd(o * 2 + 1, md + 1, r);
  mn[o] = min(mn[o * 2], mn[o * 2 + 1]);
}
void mod(int o, int l, int r, int x, int y) {
  if (l == r) {
    mn[o] = y;
    return;
  }
  int md = (l + r) / 2;
  if (x <= md)
    mod(o * 2, l, md, x, y);
  else
    mod(o * 2 + 1, md + 1, r, x, y);
  mn[o] = min(mn[o * 2], mn[o * 2 + 1]);
}
int q(int o, int l, int r, int x, int y) {
  if (y < l || r < x) return 1e9;
  if (x <= l && r <= y) return mn[o];
  int md = (l + r) / 2;
  return min(q(o * 2, l, md, x, y), q(o * 2 + 1, md + 1, r, x, y));
}
void g1(int x, int fa) {
  sz[x] = 1;
  f[x] = fa;
  if (x > n) a[x] = 1e9;
  for (int i = h2[x]; i; i = nxt2[i])
    if (v2[i] != fa) {
      dep[v2[i]] = dep[x] + 1;
      g1(v2[i], x);
      sz[x] += sz[v2[i]];
      if (sz[v2[i]] > sz[p[x]]) p[x] = v2[i];
      if (x > n) {
        a[x] = min(a[x], a[v2[i]]);
        ss[x].insert(a[v2[i]]);
      }
    }
}
void g2(int x, int fa, int tt) {
  id[x] = ++ct;
  aa[ct] = a[x];
  tp[x] = tt;
  if (p[x]) g2(p[x], x, tt);
  for (int i = h2[x]; i; i = nxt2[i])
    if (v2[i] != fa && v2[i] != p[x]) g2(v2[i], x, v2[i]);
}
int qm(int x, int y) {
  int r = 1e9;
  while (tp[x] != tp[y]) {
    if (dep[tp[x]] < dep[tp[y]]) swap(x, y);
    r = min(r, q(1, 1, bc, id[tp[x]], id[x]));
    x = f[tp[x]];
  }
  if (dep[y] > dep[x])
    r = min(r, q(1, 1, bc, id[x], id[y]));
  else
    r = min(r, q(1, 1, bc, id[y], id[x]));
  if (x > n && f[x]) r = min(r, a[f[x]]);
  return r;
}
int main() {
  int m, q;
  scanf("%d%d%d", &n, &m, &q);
  bc = n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    ad1(a, b);
    ad1(b, a);
  }
  dfs(1);
  g1(1, 0);
  g2(1, 0, 1);
  bd(1, 1, bc);
  while (q--) {
    char s[5];
    scanf("%s", s);
    if (s[0] == 'C') {
      int x, y;
      scanf("%d%d", &x, &y);
      if (f[x]) ss[f[x]].erase(ss[f[x]].find(a[x]));
      if (f[x]) ss[f[x]].insert(y);
      a[x] = y;
      if (f[x]) {
        if (ss[f[x]].size())
          a[f[x]] = *ss[f[x]].begin();
        else
          a[f[x]] = 1e9;
      }
      mod(1, 1, bc, id[x], y);
      if (f[x]) mod(1, 1, bc, id[f[x]], a[f[x]]);
    } else {
      int x, y;
      scanf("%d%d", &x, &y);
      printf("%d\n", qm(x, y));
    }
  }
}
