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;
struct edge {
  int v, nxt;
} e[200005 << 1];
int top = 1;
int head[200005];
void Add_Edge(int u, int v) {
  e[++top] = edge{v, head[u]};
  head[u] = top;
  e[++top] = edge{u, head[v]};
  head[v] = top;
}
stack<int> s;
int n, m, q, ext, Index;
int dfn[200005], low[200005];
vector<int> G[200005];
void Tarjan(int u, int par) {
  dfn[u] = low[u] = ++Index;
  s.push(u);
  for (register int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (v == par) continue;
    if (!dfn[v]) {
      Tarjan(v, u);
      low[u] = min(low[u], low[v]);
      if (low[v] >= dfn[u]) {
        G[u].push_back(++ext);
        G[ext].push_back(u);
        int last = 0;
        do {
          last = s.top();
          s.pop();
          G[ext].push_back(last);
          G[last].push_back(ext);
        } while (last != v);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
int val[200005], tur[200005];
class Segment {
 private:
  struct node {
    int l, r, minn;
  } tree[200005 << 2];
  void Pushup(int i) {
    tree[i].minn = min(tree[(i << 1)].minn, tree[(i << 1 | 1)].minn);
  }

 public:
  void build(int i, int l, int r) {
    tree[i].l = l, tree[i].r = r;
    if (l == r) return tree[i].minn = val[tur[l]], void();
    int mid = (l + r) >> 1;
    build((i << 1), l, mid);
    build((i << 1 | 1), mid + 1, r);
    Pushup(i);
  }
  void update(int i, int pos, int value) {
    if (tree[i].l > pos || pos > tree[i].r) return;
    if (tree[i].l == tree[i].r) return tree[i].minn = value, void();
    update((i << 1), pos, value);
    update((i << 1 | 1), pos, value);
    Pushup(i);
  }
  int query(int i, int l, int r) {
    if (tree[i].l > r || l > tree[i].r) return (0x7f7f7f7f);
    if (tree[i].l >= l && tree[i].r <= r) return tree[i].minn;
    return min(query((i << 1), l, r), query((i << 1 | 1), l, r));
  }
};
Segment Tree;
int Top[200005], son[200005], dep[200005], pat[200005], size[200005];
void dfs1(int u, int fa) {
  pat[u] = fa, size[u] = 1, dep[u] = dep[fa] + 1;
  for (register int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (v == fa) continue;
    dfs1(v, u);
    size[u] += size[v];
    if (size[v] > size[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int TOP) {
  dfn[u] = ++Index, tur[Index] = u, Top[u] = TOP;
  if (son[u]) dfs2(son[u], TOP);
  for (register int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (v == pat[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
int query(int x, int y) {
  int Ans = (0x7f7f7f7f);
  while (Top[x] != Top[y]) {
    if (dep[Top[x]] < dep[Top[y]]) swap(x, y);
    Ans = min(Ans, Tree.query(1, dfn[Top[x]], dfn[x]));
    x = pat[Top[x]];
  }
  if (dfn[x] > dfn[y]) swap(x, y);
  Ans = min(Ans, Tree.query(1, dfn[x], dfn[y]));
  if (x > n) Ans = min(Ans, val[pat[x]]);
  return Ans;
}
int read() {
  int x = 0;
  char c = getchar();
  int f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return x * f;
}
void write(int x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
multiset<int> S[200005];
signed main() {
  n = ext = read(), m = read(), q = read();
  for (register int i = 1; i <= n; ++i) val[i] = read();
  for (register int i = 1; i <= m; ++i) {
    int u = read(), v = read();
    Add_Edge(u, v);
  }
  Tarjan(1, 0);
  Index = 0, dfs1(1, 0), dfs2(1, 1);
  for (register int i = 2; i <= n; ++i) S[pat[i]].insert(val[i]);
  for (register int i = n + 1; i <= ext; ++i)
    val[i] = S[i].empty() ? (0x7f7f7f7f) : *S[i].begin();
  Tree.build(1, 1, ext);
  while (q--) {
    char s[5] = {};
    scanf("%s", s);
    if (s[0] == 'C') {
      int x = read(), w = read();
      Tree.update(1, dfn[x], w);
      if (pat[x]) {
        int u = pat[x];
        S[u].erase(S[u].lower_bound(val[x]));
        S[u].insert(w);
        if (val[u] != *S[u].begin()) {
          val[u] = *S[u].begin();
          Tree.update(1, dfn[u], val[u]);
        }
      }
      val[x] = w;
    } else {
      int a = read(), b = read();
      write(query(a, b)), putchar('\n');
    }
  }
  return 0;
}
