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;
template <class T>
inline void in(T &x) {
  x = 0;
  short f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
  x *= f;
}
template <class T>
inline void out(T x, const char c = '\n') {
  static short st[30];
  short m = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++m] = x % 10, x /= 10;
  while (x);
  while (m) putchar(st[m--] | '0');
  putchar(c);
}
namespace i207M {
int n, m;
int val[1000005];
int tot;
int v[1000005], nx[1000005], head[1000005], cnte;
inline void adde(int uu, int vv) {
  v[++cnte] = vv, nx[cnte] = head[uu], head[uu] = cnte;
}
namespace Pre {
int v[1000005], nx[1000005], head[1000005], cnte;
inline void padde(int uu, int vv) {
  v[++cnte] = vv, nx[cnte] = head[uu], head[uu] = cnte;
}
int dfn[1000005], low[1000005], dk;
int st[1000005], tp;
void tarjan(int x, int f) {
  dfn[x] = low[x] = ++dk;
  st[++tp] = x;
  for (register int i = head[x]; i; i = nx[i])
    if (v[i] != f) {
      if (!dfn[v[i]]) {
        tarjan(v[i], x), low[x] = min(low[v[i]], low[x]);
        if (dfn[x] <= low[v[i]]) {
          ++tot;
          int t;
          do {
            t = st[tp--];
            adde(tot, t), adde(t, tot);
          } while (t != v[i]);
          adde(tot, x), adde(x, tot);
        }
      } else
        low[x] = min(dfn[v[i]], low[x]);
    }
}
}  // namespace Pre
multiset<int> st[1000005];
int fa[1000005], dep[1000005], top[1000005], sz[1000005], hsn[1000005];
int dfn[1000005], dk, ys[1000005];
void dfs(int x, int f) {
  sz[x] = 1, fa[x] = f, dep[x] = dep[f] + 1;
  for (register int i = head[x]; i; i = nx[i])
    if (v[i] != f) {
      dfs(v[i], x);
      sz[x] += sz[v[i]];
      if (sz[v[i]] > sz[hsn[x]]) hsn[x] = v[i];
    }
  if (x <= n && fa[x]) st[fa[x]].insert(val[x]);
}
void efs(int x, int t) {
  top[x] = t;
  ys[dfn[x] = ++dk] = x;
  if (hsn[x]) {
    efs(hsn[x], t);
    for (register int i = head[x]; i; i = nx[i])
      if (v[i] != fa[x] && v[i] != hsn[x]) efs(v[i], v[i]);
  }
}
const int rt = 1;
namespace Seg {
int mn[1000005];
inline void up(int x) { mn[x] = min(mn[(x << 1)], mn[(x << 1 | 1)]); }
void build(int x, int l, int r) {
  if (l == r) {
    mn[x] = val[ys[l]];
    return;
  }
  int mid((l + r) >> 1);
  build((x << 1), l, mid);
  build((x << 1 | 1), mid + 1, r);
  up(x);
}
int ask(int x, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return mn[x];
  int mid((l + r) >> 1);
  int t = 1000000001;
  if (ql <= mid) t = ask((x << 1), l, mid, ql, qr);
  if (qr > mid) t = min(ask((x << 1 | 1), mid + 1, r, ql, qr), t);
  return t;
}
void upd(int x, int l, int r, int p) {
  if (l == r) {
    mn[x] = val[ys[l]];
    return;
  }
  int mid((l + r) >> 1);
  if (p <= mid)
    upd((x << 1), l, mid, p);
  else
    upd((x << 1 | 1), mid + 1, r, p);
  up(x);
}
}  // namespace Seg
using namespace Seg;
void prework() {
  Pre::tarjan(1, 0);
  dfs(1, 0);
  efs(1, 1);
  for (register int i = n + 1; i <= tot; ++i) val[i] = *st[i].begin();
  build(rt, 1, tot);
}
void change(int x, int k) {
  if (fa[x]) {
    st[fa[x]].erase(st[fa[x]].find(val[x]));
    st[fa[x]].insert(k);
    int t = val[fa[x]];
    val[fa[x]] = *st[fa[x]].begin();
    if (t != val[fa[x]]) upd(rt, 1, tot, dfn[fa[x]]);
  }
  val[x] = k;
  upd(rt, 1, tot, dfn[x]);
}
int query(int x, int y) {
  int t = 1000000001;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    t = min(ask(rt, 1, tot, dfn[top[x]], dfn[x]), t);
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  t = min(ask(rt, 1, tot, dfn[x], dfn[y]), t);
  if (x > n) t = min(val[fa[x]], t);
  return t;
}
signed main() {
  int cntq;
  in(n), in(m), in(cntq);
  tot = n;
  for (register int i = 1; i <= n; ++i) in(val[i]);
  for (register int i = 1, a, b; i <= m; ++i) {
    in(a), in(b);
    Pre::padde(a, b), Pre::padde(b, a);
  }
  prework();
  char tc[3];
  int x, y;
  while (cntq--) {
    scanf("%1s%d%d", tc, &x, &y);
    if (tc[0] == 'C')
      change(x, y);
    else
      out(query(x, y));
  }
  return 0;
}
}  // namespace i207M
signed main() {
  i207M::main();
  return 0;
}
