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 = 301000, inf = 1e9 + 1e4;
int read() {
  int res = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) res = (res << 1) + (res << 3) + (c ^ '0');
  return res * f;
}
int n, m, q, w[N], maxn;
bool is_sqr[N];
vector<int> G[N], T[N];
int dfn[N], dfc, low[N], stk[N], stk_top;
bool instk[N];
int bcnt, bel[N], Siz[N];
struct Set {
  multiset<int> s;
  void ins(int x) { s.insert(x); }
  void del(int x) { s.erase(s.find(x)); }
  int min() { return *s.begin(); }
} s[100005];
void add_edge(int u, int v) {
  T[u].push_back(v);
  T[v].push_back(u);
}
void Tarjan(int u, int prt) {
  low[u] = dfn[u] = ++dfc;
  stk[++stk_top] = u;
  for (auto to : G[u]) {
    if (to == prt) continue;
    if (!dfn[to]) {
      Tarjan(to, u);
      low[u] = min(low[u], low[to]);
      if (low[to] > dfn[u]) {
        add_edge(u, to);
        while (true) {
          int x = stk[stk_top--];
          if (x == to) break;
        }
      } else if (low[to] == dfn[u]) {
        int sx = ++maxn;
        is_sqr[sx] = 1;
        add_edge(u, sx);
        while (true) {
          int x = stk[stk_top--];
          add_edge(sx, x);
          s[sx].ins(w[x]);
          if (x == to) break;
        }
        w[sx] = s[sx].min();
      }
    } else
      low[u] = min(low[u], dfn[to]);
  }
}
int siz[N], son[N], top[N], fa[N], dep[N], out[N];
void DFS(int u, int prt) {
  siz[u] = 1;
  for (auto to : T[u]) {
    if (to == prt) continue;
    dep[to] = dep[u] + 1;
    DFS(to, u);
    siz[u] += siz[to];
    fa[to] = u;
    if (!son[u] || siz[son[u]] < siz[to]) son[u] = to;
  }
}
void DFS2(int u, int prt, int t) {
  top[u] = t;
  out[dfn[u] = ++dfc] = u;
  if (son[u]) DFS2(son[u], u, t);
  for (auto to : T[u]) {
    if (to == son[u] || to == prt) continue;
    DFS2(to, u, to);
  }
}
int mn[N << 2];
void up(int x) { mn[x] = min(mn[x << 1], mn[x << 1 | 1]); }
void build(int x, int s = 1, int t = maxn) {
  if (s == t) return mn[x] = w[out[s]], void();
  int mid = s + t >> 1;
  build(x << 1, s, mid);
  build(x << 1 | 1, mid + 1, t);
  up(x);
}
void modify(int x, int p, int s = 1, int t = maxn) {
  if (s == t) return mn[x] = w[out[s]], void();
  int mid = s + t >> 1;
  if (p <= mid)
    modify(x << 1, p, s, mid);
  else
    modify(x << 1 | 1, p, mid + 1, t);
  up(x);
}
int query(int x, int qs, int qt, int s = 1, int t = maxn) {
  if (qs <= s && t <= qt) return mn[x];
  int mid = s + t >> 1, res = inf;
  if (qs <= mid) res = min(res, query(x << 1, qs, qt, s, mid));
  if (qt > mid) res = min(res, query(x << 1 | 1, qs, qt, mid + 1, t));
  return res;
}
int solve(int x, int y) {
  int res = inf;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    res = min(res, query(1, dfn[top[x]], dfn[x]));
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  res = min(res, query(1, dfn[x], dfn[y]));
  if (is_sqr[x]) res = min(res, w[fa[x]]);
  return res;
}
int main() {
  n = read();
  m = read();
  q = read();
  for (int i = 1; i <= n; ++i) w[i] = read();
  for (int i = 1, u, v; i <= m; ++i) {
    u = read();
    v = read();
    G[u].push_back(v);
    G[v].push_back(u);
  }
  maxn = n;
  Tarjan(1, 0);
  dfc = 0;
  fill(dfn + 1, dfn + maxn + 1, 0);
  DFS(1, 0);
  DFS2(1, 0, 1);
  build(1, 1, maxn);
  char opt[4];
  for (int i = 1, x, y, sx; i <= q; ++i) {
    scanf("%s", opt);
    if (opt[0] == 'A') {
      x = read();
      y = read();
      cout << solve(x, y) << '\n';
    } else {
      x = read();
      y = read();
      sx = fa[x];
      if (is_sqr[sx]) {
        s[sx].del(w[x]);
        s[sx].ins(y);
        w[sx] = s[sx].min();
        modify(1, dfn[sx]);
      }
      w[x] = y;
      modify(1, dfn[x]);
    }
  }
  return 0;
}
