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;
const int N = 2e5 + 2, M = 4e5 + 2, O = 8e5 + 2, P = 1.6e6 + 2,
          inf = 2147483647;
priority_queue<int, vector<int>, greater<int> > a[M], d[M];
int l[P], r[P], s[P], lj[M], nxt[M], v[M], fir[M], flj[M], fnxt[M], ffir[N],
    top[M], siz[M], dfn[M];
int low[N], hc[M], st[N], dep[M], f[M], nfd[M], dy[M];
int n, m, q, i, j, x, y, z, c, bs, fbs, fs, tp, ans;
inline void read(int &x) {
  c = getchar();
  while ((c < 48) || (c > 57)) c = getchar();
  x = c ^ 48;
  c = getchar();
  while ((c >= 48) && (c <= 57)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
}
inline void fadd() {
  flj[++fbs] = y;
  fnxt[fbs] = ffir[x];
  ffir[x] = fbs;
  flj[++fbs] = x;
  fnxt[fbs] = ffir[y];
  ffir[y] = fbs;
}
inline void add(int x, int y) {
  lj[++bs] = y;
  nxt[bs] = fir[x];
  fir[x] = bs;
  f[y] = x;
}
void dfs1(int x) {
  int i;
  dfn[x] = low[st[++tp] = x] = ++bs;
  for (i = ffir[x]; i; i = fnxt[i])
    if (dfn[flj[i]])
      low[x] = min(low[x], dfn[flj[i]]);
    else {
      dfs1(flj[i]);
      if (dfn[x] <= low[flj[i]]) {
        ++fs;
        while (st[tp + 1] != flj[i]) {
          a[fs].push(v[st[tp]]);
          add(fs, st[tp--]);
        }
        v[fs] = a[fs].top();
        add(x, fs);
      } else
        low[x] = min(low[x], low[flj[i]]);
    }
}
void dfs2(int x) {
  siz[x] = 1;
  int i;
  for (i = fir[x]; i; i = nxt[i]) {
    dep[lj[i]] = dep[x] + 1;
    dfs2(lj[i]);
    siz[x] += siz[lj[i]];
    if (siz[lj[i]] > siz[hc[x]]) hc[x] = lj[i];
  }
}
void dfs3(int x) {
  nfd[dfn[x] = ++y] = x;
  if (hc[x]) {
    int i;
    top[hc[x]] = top[x];
    dfs3(hc[x]);
    for (i = fir[x]; i; i = nxt[i])
      if (lj[i] != hc[x]) dfs3(top[lj[i]] = lj[i]);
  }
}
void build(int x) {
  if (l[x] == r[x]) {
    s[x] = v[nfd[l[x]]];
    dy[nfd[l[x]]] = x;
    return;
  }
  l[c = x << 1] = l[x];
  r[c] = l[x] + r[x] >> 1;
  l[c | 1] = r[c] + 1;
  r[c | 1] = r[x];
  build(c);
  build(x << 1 | 1);
  s[x] = min(s[x << 1], s[x << 1 | 1]);
}
inline void pushup(int x) {
  while (x = x >> 1) s[x] = min(s[x << 1], s[x << 1 | 1]);
}
void sum(int x) {
  if ((z <= l[x]) && (r[x] <= y)) {
    ans = min(ans, s[x]);
    return;
  }
  if ((z <= r[x << 1]) && (s[x << 1] < ans)) sum(x << 1);
  if ((y > r[x << 1]) && (s[x << 1 | 1] < ans)) sum(x << 1 | 1);
}
inline void sol(int xx, int yy) {
  while (top[xx] != top[yy]) {
    if (dep[top[xx]] < dep[top[yy]]) swap(xx, yy);
    z = dfn[top[xx]];
    y = dfn[xx];
    sum(1);
    xx = f[top[xx]];
  }
  if (dep[xx] > dep[yy]) swap(xx, yy);
  z = dfn[xx];
  y = dfn[yy];
  sum(1);
  if (xx > n) ans = min(ans, v[f[xx]]);
  printf("%d\n", ans);
}
int main() {
  read(n);
  read(m);
  read(q);
  fs = n;
  for (i = 1; i <= n; i++) read(v[i]);
  while (m--) {
    read(x);
    read(y);
    fadd();
  }
  bs = y = 0;
  dfs1(1);
  dfs2(dep[1] = 1);
  dfs3(top[1] = 1);
  r[l[1] = 1] = fs;
  build(1);
  while (q--) {
    c = getchar();
    while ((c != 'A') && (c != 'C')) c = getchar();
    if (c == 'A') {
      read(x);
      read(y);
      ans = inf;
      sol(x, y);
    } else {
      read(x);
      read(y);
      if (x != 1) {
        d[f[x]].push(v[x]);
        a[f[x]].push(y);
        while ((!d[f[x]].empty()) && (d[f[x]].top() == a[f[x]].top())) {
          d[f[x]].pop();
          a[f[x]].pop();
        }
        if (v[f[x]] != a[f[x]].top()) {
          s[dy[f[x]]] = v[f[x]] = a[f[x]].top();
          pushup(dy[f[x]]);
        }
      }
      s[dy[x]] = v[x] = y;
      pushup(dy[x]);
    }
  }
}
