#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef complex<double> Point;
struct Edge{
    int from, to, id;
    Edge() {}
    Edge(int a, int b, int id) : from(a), to(b), id(id) {}
};

double angle(Point a, Point b){
    double th = arg(conj(a) * b);
    return (th >= 0) ? th : th + 2.0 * M_PI;
}

namespace std{
    bool operator < (const Point& a, const Point& b){
        if(a.real() != b.real()) return a.real() < b.real();
        return a.imag() < b.imag();
    }
}

int main(){
    int N, M;
    while(cin >> N >> M && N){
        vector<Point> ps(N);
        REP(i, N){
            double x, y;
            cin >> x >> y;
            ps[i] = Point(x, y);
        }
        vector<Edge> edges;
        vector<vector<Edge>> G(N);
        REP(i, M){
            int a, b;
            cin >> a >> b;
            a--; b--;
            edges.push_back(Edge(a, b, 2 * i));
            edges.push_back(Edge(b, a, 2 * i + 1));
            G[a].push_back(edges[2 * i]);
            G[b].push_back(edges[2 * i + 1]);
        }

        int F = 0;
        vector<int> face(2 * M, -1); // ティツセツコテ」ツ?ョテ・ツ渉ウテ・ツ?エテ」ツ?ョテゥツ敖「テ」ツ?ョid
        for(int i = 0; i < 2 * M; i++){
            if(face[i] != -1) continue;
            int cur_e = i;
            int prev_p = edges[i].from;
            int cur_p = edges[i].to;
            while(face[cur_e] == -1){
                face[cur_e] = F;
                int next_e = -1;
                int next_p = -1;
                double next_arg = 1e16;
                for(int i = 0; i < G[cur_p].size(); i++){
                    int to = G[cur_p][i].to;
                    if(to == prev_p) continue;
                    double arg = angle(ps[prev_p] - ps[cur_p], ps[to] - ps[cur_p]);
                    if(next_arg > arg){
                        next_arg = arg;
                        next_e = G[cur_p][i].id;
                        next_p = to;
                    }
                }
                assert(next_e != -1);
                cur_e = next_e;
                prev_p = cur_p;
                cur_p = next_p;
            }
            F++;
        }

        bool connected[600][600] = {};
        for(int i = 0; i < M; i++){
            int f1 = face[2 * i];
            int f2 = face[2 * i + 1];
            connected[f1][f2] = connected[f2][f1] = true;
        }

        int base = min_element(ps.begin(), ps.end()) - ps.begin();
        int start = -1;
        Edge tmp;
        double min_agl = 1e8;
        for(int i = 0; i < G[base].size(); i++){
            Edge e = G[base][i];
            double agl = arg(ps[e.to] - ps[e.from]);
            if(min_agl > agl){
                min_agl = agl;
                start = face[e.id];
                tmp = e;
            }
        }

        vector<int> dist(F, -1);
        queue<int> que;
        que.push(start);
        dist[start] = 0;
        while(!que.empty()){
            int from = que.front(); que.pop();
            for(int to = 0; to < F; to++){
                if(connected[from][to] && dist[to] == -1){
                    dist[to] = dist[from] + 1;
                    que.push(to);
                }
            }
        }
        cout << *max_element(dist.begin(), dist.end()) << endl;
    }
    return 0;
}

Measured memory_bytes: 1672