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;
inline int gi() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
  return sum;
}
inline char gc() {
  char c = getchar();
  while (c < 'A' || c > 'Z') c = getchar();
  return c;
}
const int maxn = 100005;
int n, m, q, w[maxn << 1];
struct edge {
  int to, next;
} e[maxn << 1];
int h[maxn], tot;
inline void add(int u, int v) {
  e[++tot] = (edge){v, h[u]};
  h[u] = tot;
  e[++tot] = (edge){u, h[v]};
  h[v] = tot;
}
vector<int> to[maxn << 1];
int cnt, dep[maxn << 1], siz[maxn << 1], son[maxn << 1], ord[maxn << 1],
    dfn[maxn << 1], low[maxn << 1], Time, fa[maxn << 1], top[maxn << 1];
struct {
  priority_queue<int, vector<int>, greater<int> > q1, q2;
  int Top() {
    while (!q2.empty() && q1.top() == q2.top()) q1.pop(), q2.pop();
    return q1.top();
  }
  void insert(int x) { q1.push(x); }
  void erase(int x) { q2.push(x); }
} val[maxn];
void dfs1(int u) {
  dep[u] = dep[fa[u]] + 1;
  siz[u] = 1;
  for (int v : to[u])
    if (v != fa[u]) {
      fa[v] = u;
      dfs1(v);
      siz[u] += siz[v];
      if (siz[v] > siz[son[u]]) son[u] = v;
      if (u > n) val[u - n].insert(w[v]);
    }
  if (u > n) w[u] = val[u - n].Top();
}
void dfs2(int u) {
  ord[dfn[u] = ++Time] = u;
  if (son[u])
    top[son[u]] = top[u], dfs2(son[u]);
  else
    low[top[u]] = Time;
  for (int v : to[u])
    if (v != fa[u] && v != son[u]) top[v] = v, dfs2(v);
}
int rt[maxn << 1], Min[maxn << 3], lch[maxn << 3], rch[maxn << 3];
void build(int &s, int l, int r) {
  s = ++tot;
  if (s > 2e5 * 4) puts("fuck you"), exit(0);
  if (l == r) return Min[s] = w[ord[l]], void();
  build(lch[s], l, ((l + r) >> 1));
  build(rch[s], ((l + r) >> 1) + 1, r);
  Min[s] = min(Min[lch[s]], Min[rch[s]]);
}
void modify(int &s, int l, int r, int p) {
  if (l == r) return Min[s] = w[ord[l]], void();
  if (p <= ((l + r) >> 1))
    modify(lch[s], l, ((l + r) >> 1), p);
  else
    modify(rch[s], ((l + r) >> 1) + 1, r, p);
  Min[s] = min(Min[lch[s]], Min[rch[s]]);
}
int query(int s, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return Min[s];
  if (qr <= ((l + r) >> 1))
    return query(lch[s], l, ((l + r) >> 1), ql, qr);
  else if (ql > ((l + r) >> 1))
    return query(rch[s], ((l + r) >> 1) + 1, r, ql, qr);
  else
    return min(query(lch[s], l, ((l + r) >> 1), ql, qr),
               query(rch[s], ((l + r) >> 1) + 1, r, ql, qr));
}
void modify(int v, int u) {
  if (fa[u])
    val[fa[u] - n].erase(w[u]), val[fa[u] - n].insert(v),
        w[fa[u]] = val[fa[u] - n].Top();
  w[u] = v;
  modify(rt[top[u]], dfn[top[u]], low[top[u]], dfn[u]);
  if (fa[u]) u = fa[u], modify(rt[top[u]], dfn[top[u]], low[top[u]], dfn[u]);
}
int query(int u, int v) {
  int ans = 1e9;
  while (top[u] != top[v]) {
    if (dep[top[u]] > dep[top[v]])
      ans = min(ans, query(rt[top[u]], dfn[top[u]], low[top[u]], dfn[top[u]],
                           dfn[u])),
      u = fa[top[u]];
    else
      ans = min(ans, query(rt[top[v]], dfn[top[v]], low[top[v]], dfn[top[v]],
                           dfn[v])),
      v = fa[top[v]];
  }
  if (dfn[u] > dfn[v]) swap(u, v);
  ans = min(ans, query(rt[top[v]], dfn[top[v]], low[top[v]], dfn[u], dfn[v]));
  if (u > n) ans = min(ans, w[fa[u]]);
  return ans;
}
namespace Tarjan {
int dfn[maxn], low[maxn], Time, stk[maxn], top;
void dfs(int u) {
  dfn[u] = low[u] = ++Time;
  stk[++top] = u;
  for (int i = h[u], v; v = e[i].to, i; i = e[i].next)
    if (!dfn[v]) {
      dfs(v);
      low[u] = min(low[u], low[v]);
      if (dfn[u] == low[v]) {
        ++cnt;
        while (stk[top + 1] != v)
          to[stk[top]].push_back(cnt), to[cnt].push_back(stk[top]), --top;
        to[u].push_back(cnt), to[cnt].push_back(u);
      }
    } else
      low[u] = min(low[u], dfn[v]);
}
}  // namespace Tarjan
int main() {
  n = gi();
  m = gi();
  q = gi();
  for (int i = 1; i <= n; ++i) w[i] = gi();
  for (int i = 1; i <= m; ++i) add(gi(), gi());
  cnt = n;
  for (int i = 1; i <= n; ++i)
    if (!Tarjan::dfn[i]) Tarjan::dfs(i);
  for (int i = 1; i <= cnt; ++i)
    if (!fa[i]) dfs1(i);
  Time = 0;
  for (int i = 1; i <= cnt; ++i)
    if (!top[i]) top[i] = i, dfs2(i);
  tot = 0;
  for (int i = 1; i <= cnt; ++i)
    if (top[i] == i) build(rt[i], dfn[i], low[i]);
  for (int i = 1; i <= q; ++i) {
    char c = gc();
    if (c == 'C')
      modify(gi(), gi());
    else
      printf("%d\n", query(gi(), gi()));
  }
  return 0;
}
