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 = 100005;
const int M = 525000;
int n, m, q, fangsz;
int v[N];
struct Segment {
  int t[M];
  void change(int k, int l, int r, int p, int v) {
    if (l == r) {
      t[k] = v;
      return;
    }
    int mid = (l + r) / 2;
    if (p <= mid)
      change(k * 2, l, mid, p, v);
    else
      change(k * 2 + 1, mid + 1, r, p, v);
    t[k] = min(t[k * 2], t[k * 2 + 1]);
  }
  int ask(int k, int l, int r, int x, int y) {
    if (l == x && r == y) return t[k];
    int mid = (l + r) / 2;
    if (y <= mid) return ask(k * 2, l, mid, x, y);
    if (x > mid) return ask(k * 2 + 1, mid + 1, r, x, y);
    return min(ask(k * 2, l, mid, x, mid),
               ask(k * 2 + 1, mid + 1, r, mid + 1, y));
  }
};
struct edge {
  int to, next;
};
struct Heap {
  priority_queue<int, vector<int>, greater<int> > q1, q2;
  void insert(int x) { q1.push(x); }
  void erase(int x) { q2.push(x); }
  int ask() {
    for (; !q2.empty() && q1.top() == q2.top();) q1.pop(), q2.pop();
    return q1.top();
  }
};
struct Tree2 {
  edge e[N * 4];
  int head[N * 2], tot;
  int pos[N * 2], top[N * 2], T;
  int sz[N * 2], fa[N * 2], dep[N * 2];
  Segment Seg;
  Heap hp[N * 2];
  void add(int x, int y) {
    e[++tot] = (edge){y, head[x]};
    head[x] = tot;
    e[++tot] = (edge){x, head[y]};
    head[y] = tot;
  }
  void dfs1(int x) {
    sz[x] = 1;
    for (int i = head[x]; i; i = e[i].next)
      if (e[i].to != fa[x]) {
        fa[e[i].to] = x;
        dep[e[i].to] = dep[x] + 1;
        dfs1(e[i].to);
        sz[x] += sz[e[i].to];
      }
  }
  void dfs2(int x, int tp) {
    pos[x] = ++T;
    top[x] = tp;
    int k = 0;
    for (int i = head[x]; i; i = e[i].next)
      if (e[i].to != fa[x] && sz[e[i].to] > sz[k]) k = e[i].to;
    if (k) dfs2(k, tp);
    for (int i = head[x]; i; i = e[i].next)
      if (e[i].to != fa[x] && e[i].to != k) dfs2(e[i].to, e[i].to);
  }
  void build() {
    dep[1] = 1;
    dfs1(1);
    dfs2(1, 1);
  }
  void change(int x, int val, int tp) {
    if (fa[x] > n) {
      if (tp) hp[fa[x]].erase(v[x]);
      hp[fa[x]].insert(val);
      Seg.change(1, 1, fangsz, pos[fa[x]], hp[fa[x]].ask());
    }
    if (tp) hp[x].erase(v[x]);
    hp[x].insert(v[x] = val);
    Seg.change(1, 1, fangsz, pos[x], hp[x].ask());
  }
  int ask(int x, int y) {
    int X = x, Y = y, ans = 1e9;
    for (; top[x] != top[y]; x = fa[top[x]]) {
      if (dep[top[x]] < dep[top[y]]) swap(x, y);
      ans = min(ans, Seg.ask(1, 1, fangsz, pos[top[x]], pos[x]));
    }
    if (dep[x] < dep[y]) swap(x, y);
    ans = min(ans, Seg.ask(1, 1, fangsz, pos[y], pos[x]));
    if (y != X && y != Y && y > n) ans = min(ans, hp[fa[y]].ask());
    return ans;
  }
} T2;
struct Tree1 {
  edge e[N * 2];
  int head[N], tot;
  int dfn[N], low[N];
  int sta[N], top, T;
  void add(int x, int y) {
    e[++tot] = (edge){y, head[x]};
    head[x] = tot;
  }
  void tarjan(int x, int fa) {
    sta[++top] = x;
    dfn[x] = low[x] = ++T;
    for (int i = head[x]; i; i = e[i].next)
      if (!dfn[e[i].to]) {
        int beg = top;
        tarjan(e[i].to, x);
        low[x] = min(low[x], low[e[i].to]);
        if (low[e[i].to] < dfn[x]) continue;
        fangsz++;
        T2.add(x, fangsz);
        for (; top > beg; top--) T2.add(sta[top], fangsz);
      } else if (e[i].to != fa)
        low[x] = min(low[x], dfn[e[i].to]);
  }
} T1;
int main() {
  scanf("%d%d%d", &n, &m, &q);
  fangsz = n;
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    T1.add(x, y);
    T1.add(y, x);
  }
  T1.tarjan(1, 0);
  T2.build();
  for (int i = 1; i <= n; i++) T2.change(i, v[i], 0);
  while (q--) {
    char s[5];
    int x, y;
    scanf("%s%d%d", s, &x, &y);
    if (s[0] == 'C')
      T2.change(x, y, 1);
    else
      printf("%d\n", T2.ask(x, y));
  }
}
