#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <set>

const int N=100010;

using namespace std;

#define pb push_back
#define sz(x)((x).size())

struct data
{
    int l,r,x;
    data() {}
    data(int l,int r,int x):l(l),r(r),x(x) {}
    bool operator < (const data &a) const
    {
        if(a.x!=x) return x<a.x;
        return l<a.l;
    }
}v1[N],v2[N];

int cnt1,cnt2;

int main()
{
//    freopen("in.txt","r",stdin);
    int n,m;
    int k;
    set<int> A,B;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<k;i++)
    {
        int x1,x2,y1,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(x1==x2 && (x1==0 || x1==n)) continue;
        if(y1==y2 && (y1==0 || y1==m)) continue;
        if(x1==x2) v2[cnt2++]=data(min(y1,y2),max(y1,y2),x1),B.insert(x1);
        else v1[cnt1++]=data(min(x1,x2),max(x1,x2),y1),A.insert(y1);
    }
    sort(v1,v1+cnt1);
    sort(v2,v2+cnt2);
    int a=m-1,b=n-1;
    int ret=0;
    for(int i=0,s=0;i<cnt1;)
    {
		s=0;
        int j=i;
        int tmp=n;
        while(v1[i].x==v1[j].x && j<cnt1)
        {
            if(v1[j].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        a--;
    }
    for(int i=0,s=0;i<cnt2;)
    {
		s=0;
        int j=i;
        int tmp=m;
        while(v2[i].x==v2[j].x && j<cnt2)
        {
            if(v2[j].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        b--;
    }
    if(a&1) ret^=n;
    if(b&1) ret^=m;
    if(ret)
    {
        cout<<"FIRST\n";
        if(a && n-(ret^n)>0)
        {
            for(int i=1;;i++)
            {
                if(!A.count(i))
                {
                    cout<<0<<" "<<i<<" "<<n-(ret^n)<<" "<<i<<endl;
                    return 0;
                }
            }
        }
        if(b && m-(ret^m)>=0)
        {
            for(int i=1;;i++)
            {
                if(!B.count(i))
                {
                    cout<<i<<" "<<0<<" "<<i<<" "<<m-(ret^m)<<endl;
                    return 0;
                }
            }
        }
        for(int i=0,j=0,s=0;i<cnt1;i=j)
        {
			s=0;
            int tmp=n;
            while(v1[i].x==v1[j].x && j<cnt1)
            {
                if(v1[j].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<=j;k++,S=max(S,v1[k].r))
            {
                if(v1[k].l<=S) continue;
                if(v1[k].l-S<t) {t-=v1[k].l-S;continue;}
                cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
            return 0;
        }

        for(int i=0,j=0,s=0;i<cnt2;i=j)
        {
			s=0;
            j=i;
            int tmp=m;
            while(v2[i].x==v2[j].x && j<cnt2)
            {
                if(v2[j].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<=j;k++,S=max(S,v1[k].r))
            {
                if(v2[k].l<=S) continue;
                if(v2[k].l-S<t) {t-=v2[k].l-S;continue;}
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
                return 0;
            }
            cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
            return 0;
        }
    }
    cout<<"SECOND\n";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <set>

const int N=100010;

using namespace std;

#define pb push_back
#define sz(x)((x).size())

typedef long long ll;

struct data
{
    int l,r,x;
    data() {}
    data(int l,int r,int x):l(l),r(r),x(x) {}
    bool operator < (const data &a) const
    {
        if(a.x!=x) return x<a.x;
        return l<a.l;
    }
}v1[N],v2[N];

int cnt1,cnt2;

int main()
{
//    freopen("in.txt","r",stdin);
    ll n,m;
    int k;
    set<int> A,B;
    scanf("%I64d%I64d%d",&n,&m,&k);
    for(int i=0;i<k;i++)
    {
        int x1,x2,y1,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(x1==x2) v2[cnt2++]=data(min(y1,y2),max(y1,y2),x1),A.insert(x1);
        else v1[cnt1++]=data(min(x1,x2),max(x1,x2),y1),B.insert(x2);
    }
    sort(v1,v1+cnt1);
    sort(v2,v2+cnt2);
    int a=m-1,b=n-1;
    ll ret=0;
    for(int i=0;i<cnt1;)
    {
        int j=i;
        int tmp=n;
        while(v1[i].x==v1[j].x && j<cnt1)
        {
            if(v1[i].r>v1[j].l) tmp-=v1[j].r-v1[i].r;
            else tmp-=v1[j].r-v1[j].l;
            j++;
        }
        i=j;
        ret^=tmp;
        a--;
    }
    for(int i=0;i<cnt2;)
    {
        int j=i;
        int tmp=m;
        while(v2[i].x==v2[j].x && j<cnt2)
        {
            if(v2[i].r>v2[j].l) tmp-=v2[j].r-v2[i].r;
            else tmp-=v2[j].r-v2[j].l;
            j++;
        }
        i=j;
        ret^=tmp;
        b--;
    }
    if(a&1) ret^=n;
    if(b&1) ret^=m;
    if(ret)
    {
        cout<<"FIRST\n";
        if(a && n-(ret^n)>=0)
        {
            for(int i=1;;i++)
            {
                if(!A.count(i))
                {
                    cout<<0<<" "<<i<<" "<<n-(ret^n)<<" "<<i<<endl;
                    return 0;
                }
            }
        }
        if(b && m-(ret^m)>=0)
        {
            for(int i=1;;i++)
            {
                if(!B.count(i))
                {
                    cout<<i<<" "<<0<<" "<<i<<" "<<m-(ret^m)<<endl;
                    return 0;
                }
            }
        }
        for(int i=0,j=0;i<cnt1;i=j)
        {
            int tmp=n;
            while(v1[i].x==v1[j].x && j<cnt1)
            {
                if(v1[i].r>v1[j].l) tmp-=v1[j].r-v1[i].r;
                else tmp-=v1[j].r-v1[j].l;
                j++;
            }
            ll t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
            if(v1[i].l>=t)
            {
                cout<<"TT"<<endl;
                cout<<0<<" "<<v1[i].x<<" "<<t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            t-=v1[i].l;
            for(int k=i+1;k<=j;k++)
            {
                if(v1[k-1].r>v1[k].l) continue;
                if(v1[k].l-v1[k-1].r<t) {t-=v1[k].l-v1[k-1].r;continue;}
                cout<<0<<" "<<v1[i].x<<" "<<v1[k-1].r+t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            cout<<0<<" "<<v1[i].x<<" "<<v1[j].r+t<<" "<<v1[i].x<<"\n";
            return 0;
        }

        for(int i=0,j=0;i<cnt2;i=j)
        {
            j=i;
            int tmp=m;
            while(v2[i].x==v2[j].x && j<cnt2)
            {
                if(v2[i].r>v2[j].l) tmp-=v2[j].r-v2[i].r;
                else tmp-=v2[j].r-v2[j].l;
                j++;
            }
            ll t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
            if(v2[i].l>=t)
            {
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<t<<"\n";
                return 0;
            }
            t-=v2[i].l;
            for(int k=i+1;k<=j;k++)
            {
                if(v2[k-1].r>v2[k].l) continue;
                if(v2[k].l-v2[k-1].r<t) {t-=v2[k].l-v2[k-1].r;continue;}
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<v2[k-1].r+t<<"\n";
                return 0;
            }
            cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<v2[j].r+t<<"\n";
            return 0;
        }
    }
    cout<<"SECOND\n";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <set>

const int N=100010;

using namespace std;

#define pb push_back
#define sz(x)((x).size())

struct data
{
    int l,r,x;
    data() {}
    data(int l,int r,int x):l(l),r(r),x(x) {}
    bool operator < (const data &a) const
    {
        if(a.x!=x) return x<a.x;
        return l<a.l;
    }
}v1[N],v2[N];

int cnt1,cnt2;

int main()
{
//    freopen("in.txt","r",stdin);
    int n,m;
    int k;
    set<int> A,B;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<k;i++)
    {
        int x1,x2,y1,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(x1==x2 && (x1==0 || x1==n)) continue;
        if(y1==y2 && (y1==0 || y1==m)) continue;
        if(x1==x2) v2[cnt2++]=data(min(y1,y2),max(y1,y2),x1),A.insert(x1);
        else v1[cnt1++]=data(min(x1,x2),max(x1,x2),y1),B.insert(x2);
    }
    sort(v1,v1+cnt1);
    sort(v2,v2+cnt2);
    int a=m-1,b=n-1;
    int ret=0;
    for(int i=0;i<cnt1;)
    {
        int j=i;
        int tmp=n;
        while(v1[i].x==v1[j].x && j<cnt1)
        {
            if(v1[i].r>v1[j].l) tmp-=v1[j].r-v1[i].r;
            else tmp-=v1[j].r-v1[j].l;
            j++;
        }
        i=j;
        ret^=tmp;
        a--;
    }
    for(int i=0;i<cnt2;)
    {
        int j=i;
        int tmp=m;
        while(v2[i].x==v2[j].x && j<cnt2)
        {
            if(v2[i].r>v2[j].l) tmp-=v2[j].r-v2[i].r;
            else tmp-=v2[j].r-v2[j].l;
            j++;
        }
        i=j;
        ret^=tmp;
        b--;
    }
    if(a&1) ret^=n;
    if(b&1) ret^=m;
    if(ret)
    {
        cout<<"FIRST\n";
        if(a && n-(ret^n)>0)
        {
            for(int i=1;;i++)
            {
                if(!A.count(i))
                {
                    cout<<0<<" "<<i<<" "<<n-(ret^n)<<" "<<i<<endl;
                    return 0;
                }
            }
        }
        if(b && m-(ret^m)>=0)
        {
            for(int i=1;;i++)
            {
                if(!B.count(i))
                {
                    cout<<i<<" "<<0<<" "<<i<<" "<<m-(ret^m)<<endl;
                    return 0;
                }
            }
        }
        for(int i=0,j=0;i<cnt1;i=j)
        {
            int tmp=n;
            while(v1[i].x==v1[j].x && j<cnt1)
            {
                if(v1[i].r>v1[j].l) tmp-=v1[j].r-v1[i].r;
                else tmp-=v1[j].r-v1[j].l;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
            if(v1[i].l>=t)
            {
                cout<<"TT"<<endl;
                cout<<0<<" "<<v1[i].x<<" "<<t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            t-=v1[i].l;
            for(int k=i+1;k<=j;k++)
            {
                if(v1[k-1].r>v1[k].l) continue;
                if(v1[k].l-v1[k-1].r<t) {t-=v1[k].l-v1[k-1].r;continue;}
                cout<<0<<" "<<v1[i].x<<" "<<v1[k-1].r+t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            cout<<0<<" "<<v1[i].x<<" "<<v1[j].r+t<<" "<<v1[i].x<<"\n";
            return 0;
        }

        for(int i=0,j=0;i<cnt2;i=j)
        {
            j=i;
            int tmp=m;
            while(v2[i].x==v2[j].x && j<cnt2)
            {
                if(v2[i].r>v2[j].l) tmp-=v2[j].r-v2[i].r;
                else tmp-=v2[j].r-v2[j].l;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
            if(v2[i].l>=t)
            {
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<t<<"\n";
                return 0;
            }
            t-=v2[i].l;
            for(int k=i+1;k<=j;k++)
            {
                if(v2[k-1].r>v2[k].l) continue;
                if(v2[k].l-v2[k-1].r<t) {t-=v2[k].l-v2[k-1].r;continue;}
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<v2[k-1].r+t<<"\n";
                return 0;
            }
            cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<v2[j].r+t<<"\n";
            return 0;
        }
    }
    cout<<"SECOND\n";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <set>

const int N=100010;

using namespace std;

#define pb push_back
#define sz(x)((x).size())

struct data
{
    int l,r,x;
    data() {}
    data(int l,int r,int x):l(l),r(r),x(x) {}
    bool operator < (const data &a) const
    {
        if(a.x!=x) return x<a.x;
        return l<a.l;
    }
}v1[N],v2[N];

int cnt1,cnt2;

int main()
{
//    freopen("in.txt","r",stdin);
    int n,m;
    int k;
    set<int> A,B;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<k;i++)
    {
        int x1,x2,y1,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(x1==x2 && (x1==0 || x1==n)) continue;
        if(y1==y2 && (y1==0 || y1==m)) continue;
        if(x1==x2) v2[cnt2++]=data(min(y1,y2),max(y1,y2),x1),B.insert(x1);
        else v1[cnt1++]=data(min(x1,x2),max(x1,x2),y1),A.insert(y1);
    }
    sort(v1,v1+cnt1);
    sort(v2,v2+cnt2);
    int a=m-1,b=n-1;
    int ret=0;
    for(int i=0,s=0;i<cnt1;)
    {
        int j=i;
        int tmp=n;
        while(v1[i].x==v1[j].x && j<cnt1)
        {
            if(v1[i].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        a--;
    }
    for(int i=0,s=0;i<cnt2;)
    {
        int j=i;
        int tmp=m;
        while(v2[i].x==v2[j].x && j<cnt2)
        {
            if(v2[i].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        b--;
    }
    if(a&1) ret^=n;
    if(b&1) ret^=m;
    if(ret)
    {
        cout<<"FIRST\n";
        if(a && n-(ret^n)>0)
        {
            for(int i=1;;i++)
            {
                if(!A.count(i))
                {
                    cout<<0<<" "<<i<<" "<<n-(ret^n)<<" "<<i<<endl;
                    return 0;
                }
            }
        }
        if(b && m-(ret^m)>=0)
        {
            for(int i=1;;i++)
            {
                if(!B.count(i))
                {
                    cout<<i<<" "<<0<<" "<<i<<" "<<m-(ret^m)<<endl;
                    return 0;
                }
            }
        }
        for(int i=0,j=0,s=0;i<cnt1;i=j)
        {
            int tmp=n;
            while(v1[i].x==v1[j].x && j<cnt1)
            {
                if(v1[i].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<=j;k++,S=max(S,v1[k].r))
            {
                if(v1[k].l<=S) continue;
                if(v1[k].l-S<t) {t-=v1[k].l-S;continue;}
                cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
            return 0;
        }

        for(int i=0,j=0,s=0;i<cnt2;i=j)
        {
            j=i;
            int tmp=m;
            while(v2[i].x==v2[j].x && j<cnt2)
            {
                if(v2[i].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<=j;k++,S=max(S,v1[k].r))
            {
                if(v2[k].l<=S) continue;
                if(v2[k].l-S<t) {t-=v2[k].l-S;continue;}
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
                return 0;
            }
            cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
            return 0;
        }
    }
    cout<<"SECOND\n";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <set>

const int N=100010;

using namespace std;

#define pb push_back
#define sz(x)((x).size())

struct data
{
    int l,r,x;
    data() {}
    data(int l,int r,int x):l(l),r(r),x(x) {}
    bool operator < (const data &a) const
    {
        if(a.x!=x) return x<a.x;
        return l<a.l;
    }
}v1[N],v2[N];

int cnt1,cnt2;

int main()
{
//    freopen("in.txt","r",stdin);
    int n,m;
    int k;
    set<int> A,B;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<k;i++)
    {
        int x1,x2,y1,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(x1==x2 && (x1==0 || x1==n)) continue;
        if(y1==y2 && (y1==0 || y1==m)) continue;
        if(x1==x2) v2[cnt2++]=data(min(y1,y2),max(y1,y2),x1),B.insert(x1);
        else v1[cnt1++]=data(min(x1,x2),max(x1,x2),y1),A.insert(y1);
    }
    sort(v1,v1+cnt1);
    sort(v2,v2+cnt2);
    int a=m-1,b=n-1;
    int ret=0;
    for(int i=0,s=0;i<cnt1;)
    {
		s=0;
        int j=i;
        int tmp=n;
        while(v1[i].x==v1[j].x && j<cnt1)
        {
            if(v1[j].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        a--;
    }
    for(int i=0,s=0;i<cnt2;)
    {
		s=0;
        int j=i;
        int tmp=m;
        while(v2[i].x==v2[j].x && j<cnt2)
        {
            if(v2[j].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        b--;
    }
    if(a&1) ret^=n;
    if(b&1) ret^=m;
    if(ret)
    {
        cout<<"FIRST\n";
        if(a && n-(ret^n)>0)
        {
            for(int i=1;;i++)
            {
                if(!A.count(i))
                {
                    cout<<0<<" "<<i<<" "<<n-(ret^n)<<" "<<i<<endl;
                    return 0;
                }
            }
        }
        if(b && m-(ret^m)>=0)
        {
            for(int i=1;;i++)
            {
                if(!B.count(i))
                {
                    cout<<i<<" "<<0<<" "<<i<<" "<<m-(ret^m)<<endl;
                    return 0;
                }
            }
        }

        for(int i=0,j=0,s=0;i<cnt1;i=j)
        {
			s=0;
            int tmp=n;
            while(v1[i].x==v1[j].x && j<cnt1)
            {
                if(v1[j].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<j;S=max(S,v1[k].r),k++)
            {
                if(v1[k].l<=S) continue;
                if(v1[k].l-S<t) {t-=v1[k].l-S;continue;}
                cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
            return 0;
        }
        for(int i=0,j=0,s=0;i<cnt2;i=j)
        {
			s=0;
            j=i;
            int tmp=m;
            while(v2[i].x==v2[j].x && j<cnt2)
            {
                if(v2[j].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<j;S=max(S,v2[k].r),k++)
            {
                if(v2[k].l<=S) continue;
                if(v2[k].l-S<t) {t-=v2[k].l-S;continue;}
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
                return 0;
            }
            cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
            return 0;
        }
    }
    cout<<"SECOND\n";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <set>

const int N=100010;

using namespace std;

#define pb push_back
#define sz(x)((x).size())

struct data
{
    int l,r,x;
    data() {}
    data(int l,int r,int x):l(l),r(r),x(x) {}
    bool operator < (const data &a) const
    {
        if(a.x!=x) return x<a.x;
        return l<a.l;
    }
}v1[N],v2[N];

int cnt1,cnt2;

int main()
{
//    freopen("in.txt","r",stdin);
    int n,m;
    int k;
    set<int> A,B;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<k;i++)
    {
        int x1,x2,y1,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(x1==x2 && (x1==0 || x1==n)) continue;
        if(y1==y2 && (y1==0 || y1==m)) continue;
        if(x1==x2) v2[cnt2++]=data(min(y1,y2),max(y1,y2),x1),B.insert(x1);
        else v1[cnt1++]=data(min(x1,x2),max(x1,x2),y1),A.insert(y1);
    }
    sort(v1,v1+cnt1);
    sort(v2,v2+cnt2);
    int a=m-1,b=n-1;
    int ret=0;
    for(int i=0,s=0;i<cnt1;)
    {
		s=0;
        int j=i;
        int tmp=n;
        while(v1[i].x==v1[j].x && j<cnt1)
        {
            if(v1[j].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        a--;
    }
    for(int i=0,s=0;i<cnt2;)
    {
		s=0;
        int j=i;
        int tmp=m;
        while(v2[i].x==v2[j].x && j<cnt2)
        {
            if(v2[j].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
            j++;
        }
        i=j;
        ret^=tmp;
        b--;
    }
    if(a&1) ret^=n;
    if(b&1) ret^=m;
    if(ret)
    {
        cout<<"FIRST\n";
        if(a && n-(ret^n)>0)
        {
            for(int i=1;;i++)
            {
                if(!A.count(i))
                {
                    cout<<0<<" "<<i<<" "<<n-(ret^n)<<" "<<i<<endl;
                    return 0;
                }
            }
        }
        if(b && m-(ret^m)>=0)
        {
            for(int i=1;;i++)
            {
                if(!B.count(i))
                {
                    cout<<i<<" "<<0<<" "<<i<<" "<<m-(ret^m)<<endl;
                    return 0;
                }
            }
        }

        for(int i=0,j=0,s=0;i<cnt1;i=j)
        {
			s=0;
            int tmp=n;
            while(v1[i].x==v1[j].x && j<cnt1)
            {
                if(v1[j].r>s) tmp-=v1[j].r-max(s,v1[j].l),s=v1[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<=j;S=max(S,v1[k].r),k++)
            {
                if(v1[k].l<=S) continue;
                if(v1[k].l-S<t) {t-=v1[k].l-S;continue;}
                cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
                return 0;
            }
            cout<<0<<" "<<v1[i].x<<" "<<S+t<<" "<<v1[i].x<<"\n";
            return 0;
        }
        for(int i=0,j=0,s=0;i<cnt2;i=j)
        {
			s=0;
            j=i;
            int tmp=m;
            while(v2[i].x==v2[j].x && j<cnt2)
            {
                if(v2[j].r>s) tmp-=v2[j].r-max(s,v2[j].l),s=v2[j].r;
                j++;
            }
            int t =tmp^ret;
            if(tmp<t) continue;
            t=tmp-t;
			int S=0;
            for(int k=i;k<=j;S=max(S,v2[k].r),k++)
            {
                if(v2[k].l<=S) continue;
                if(v2[k].l-S<t) {t-=v2[k].l-S;continue;}
                cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
                return 0;
            }
            cout<<v2[i].x<<" "<<0<<" "<<v2[i].x<<" "<<S+t<<"\n";
            return 0;
        }
    }
    cout<<"SECOND\n";
    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

    if (n == 999999999 && m == 1) printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

    if (n >= 100000) printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

//  printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

    if (n >= 999999999) printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef pair <int, int> PII;
typedef vector <PII> VPII;
typedef map <int, int> MII;
typedef MII::iterator MIII;
typedef map <int, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(int x1, int y1, int x2, int y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

int SEG(VPII &x) {
    int a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (int i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const int n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const int n, int i, int j) {
    int st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
    //  puts("=====");
    //  for (int k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second);
        tmp.push_back(MP(n-1, n-1));
        for (int k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second > j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
    if (foo) printf("%d %d %d %d\n", st, i, ed, i);
    else printf("%d %d %d %d\n", i, st, i, ed);
}

int main() {
    int i, j, k;
    int m, n;
    int xb, yb, xe, ye;
    int tot(0);

    scanf("%d%d%d", &n, &m, &k);
    for (i=0; i<k; ++i) {
        scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

//  printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef pair <int, int> PII;
typedef vector <PII> VPII;
typedef map <int, int> MII;
typedef MII::iterator MIII;
typedef map <int, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < tot) { \
                    i = it->first, j = tot - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < tot) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = tot - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(int x1, int y1, int x2, int y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

int SEG(VPII &x) {
    int a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (int i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const int n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const int n, int i, int j) {
    int st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(n-1, n-1));
        for (int k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second > j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
    if (foo) printf("%d %d %d %d\n", st, i, ed, i);
    else printf("%d %d %d %d\n", i, st, i, ed);
}

int main() {
    int i, j, k;
    int m, n;
    int xb, yb, xe, ye;
    int tot(0);

    scanf("%d%d%d", &n, &m, &k);
    for (i=0; i<k; ++i) {
        scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

//  printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef pair <int, int> PII;
typedef vector <PII> VPII;
typedef map <int, int> MII;
typedef MII::iterator MIII;
typedef map <int, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(int x1, int y1, int x2, int y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

int SEG(VPII &x) {
    int a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (int i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const int n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const int n, int i, int j) {
    int st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (int k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (int k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
    if (foo) printf("%d %d %d %d\n", st, i, ed, i);
    else printf("%d %d %d %d\n", i, st, i, ed);
}

int main() {
    int i, j, k;
    int m, n;
    int xb, yb, xe, ye;
    int tot(0);

    scanf("%d%d%d", &n, &m, &k);
    for (i=0; i<k; ++i) {
        scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((m - 1 - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((n - 1 - cc.size()) & 1) tot ^= m;

//  printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef pair <int, int> PII;
typedef vector <PII> VPII;
typedef map <int, int> MII;
typedef MII::iterator MIII;
typedef map <int, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(int x1, int y1, int x2, int y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

int SEG(VPII &x) {
    int a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (int i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const int n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const int n, int i, int j) {
    int st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(n, n));
//      puts("=====");
//      for (int k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second);
        for (int k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
    if (foo) printf("%d %d %d %d\n", st, i, ed, i);
    else printf("%d %d %d %d\n", i, st, i, ed);
}

int main() {
    int i, j, k;
    int m, n;
    int xb, yb, xe, ye;
    int tot(0);

    scanf("%d%d%d", &n, &m, &k);
    for (i=0; i<k; ++i) {
        scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

//  printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

    if (n == 999999999 && m == 1) {
        cout << "tot: " << tot << endl;
        cout << rr.size() << ' ' << cc.size() << endl;
    }

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef pair <int, int> PII;
typedef vector <PII> VPII;
typedef map <int, int> MII;
typedef MII::iterator MIII;
typedef map <int, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(int x1, int y1, int x2, int y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

int SEG(VPII &x) {
    int a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (int i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const int n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const int n, int i, int j) {
    int st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (int k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (int k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
    if (foo) printf("%d %d %d %d\n", st, i, ed, i);
    else printf("%d %d %d %d\n", i, st, i, ed);
}

int main() {
    int i, j, k;
    int m, n;
    int xb, yb, xe, ye;
    int tot(0);

    scanf("%d%d%d", &n, &m, &k);
    for (i=0; i<k; ++i) {
        scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

//  printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

    if (n == 999999999) printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef pair <int, int> PII;
typedef vector <PII> VPII;
typedef map <int, int> MII;
typedef MII::iterator MIII;
typedef map <int, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(int x1, int y1, int x2, int y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

int SEG(VPII &x) {
    int a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (int i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const int n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const int n, int i, int j) {
    int st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(n-1, n-1));
        for (int k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second > j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
    if (foo) printf("%d %d %d %d\n", st, i, ed, i);
    else printf("%d %d %d %d\n", i, st, i, ed);
}

int main() {
    int i, j, k;
    int m, n;
    int xb, yb, xe, ye;
    int tot(0);

    scanf("%d%d%d", &n, &m, &k);
    for (i=0; i<k; ++i) {
        scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

//  printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((n - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((m - cc.size()) & 1) tot ^= m;

    if (n >= 1000) printf("tot: %d\n", tot);

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <map>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define MP(x, y) make_pair((x), (y))
typedef long long LL;
typedef pair <LL, LL> PII;
typedef vector <PII> VPII;
typedef map <LL, LL> MII;
typedef MII::iterator MIII;
typedef map <LL, VPII> MIVPII;
typedef MIVPII::iterator MIVPIII;

MIVPII row, col;
MII rr, cc;

#define FIND(xx, n, m) for (MIII it=xx.begin(); it!=xx.end(); ++it) if ((it->second ^ tot) < it->second) { \
                    i = it->first, j = it->second - (it->second ^ tot); \
                    break; \
                 } \
                    if (i == -1 && (n ^ tot) < n) { \
                        for (k=1; k<m; ++k) if (!xx.count(k)) { \
                            i = k, j = n - (n ^ tot); \
                            break; \
                        } \
                    }

bool INSECT(LL x1, LL y1, LL x2, LL y2) {
    return x1 <= x2 && x2 <= y1 || x1 <= y2 && y2 <= y1 ||
           x2 <= x1 && x1 <= y2 || x2 <= y1 && y1 <= y2;
}

LL SEG(VPII &x) {
    LL a(x[0].first), b(x[0].second), tot(0);
    VPII tmp;
    for (LL i=0; i<x.size(); ++i) {
        if (INSECT(a, b, x[i].first, x[i].second)) {
            a = min(a, x[i].first), b = max(b, x[i].second);
        } else {
            tmp.push_back(MP(a, b));
            tot += b - a;
            a = x[i].first, b = x[i].second;
        }
    }
    tmp.push_back(MP(a, b));
    tot += b - a;
    x.swap(tmp);
    return tot;
}

void UNIQ(MIVPII &xx, MII &yy, const LL n) {
    for (MIVPIII it=xx.begin(); it!=xx.end(); ++it) {
        sort(it->second.begin(), it->second.end());
        it->second.erase(unique(it->second.begin(), it->second.end()), it->second.end());
        yy[it->first] = n - SEG(it->second);
    }
}

void GAO(bool foo, MIVPII xx, const LL n, LL i, LL j) {
    LL st(0), ed, sum(0);
    VPII tmp(xx[i]);

//  printf("ROW? %d SIZE: %d NO: %d LEFT: %d\n", foo, n, i, j);
    if (tmp.empty()) {
        ed = j;
    } else {
        tmp.push_back(MP(0, 0));
        tmp.push_back(MP(n, n));
        sort(tmp.begin(), tmp.end());
//      puts("=====");
//      for (LL k=0; k<tmp.size(); ++k) printf("[%d, %d]", tmp[k].first, tmp[k].second); puts("");
        for (LL k=0; k+1<tmp.size(); ++k) {
            if (sum + tmp[k+1].first - tmp[k].second >= j) {
                ed = tmp[k].second + j - sum;
                break;
            } else {
                sum += tmp[k+1].first - tmp[k].second;
            }
        }
    }
//  if (foo) printf("%d %d %d %d\n", st, i, ed, i);
//  else printf("%d %d %d %d\n", i, st, i, ed);
    if (foo) cout << st << ' ' << i << ' ' << ed << ' ' << i << endl;
    else cout << i << ' ' << st << ' ' << i << ' ' << ed << endl;
}

int main() {
    LL i, j, k;
    LL m, n;
    LL xb, yb, xe, ye;
    LL tot(0);

//  scanf("%d%d%d", &n, &m, &k);
    cin >> n >> m >> k;
    for (i=0; i<k; ++i) {
//      scanf("%d%d%d%d", &xb, &yb, &xe, &ye);
        cin >> xb >> yb >> xe >> ye;
        if (xb == xe) col[xb].push_back(MP(min(yb, ye), max(yb, ye)));
        else row[yb].push_back(MP(min(xb, xe), max(xb, xe)));
    }

    UNIQ(row, rr, n);
    UNIQ(col, cc, m);

//  puts("ROW");
//  for (MII::iterator it=rr.begin(); it!=rr.end(); ++it) printf("%d %d\n", it->first, it->second);
//  puts("COL");
//  for (MII::iterator it=cc.begin(); it!=cc.end(); ++it) printf("%d %d\n", it->first, it->second);

    for (MIII it=rr.begin(); it!=rr.end(); ++it) tot ^= it->second;
    if ((m - 1 - rr.size()) & 1) tot ^= n;
    for (MIII it=cc.begin(); it!=cc.end(); ++it) tot ^= it->second;
    if ((n - 1 - cc.size()) & 1) tot ^= m;

//  cout << "tot: " << tot << endl;

    if (tot == 0) {
        puts("SECOND");
    } else {
        puts("FIRST");
        i = -1, j = -1;
        FIND(rr, n, m)
            if (i != -1) GAO(true, row, n, i, j);
            else { FIND(cc, m, n) GAO(false, col, m, i, j); }
    }

    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,i,j,k,xb,yb,xe,ye,tot0,tot1,ans,stu,l,N,M,len,all0,all1,q,p;
struct cut{
	int a,b,c;
	friend int operator <(cut x,cut y){
				 return x.a<y.a||x.a==y.a&&x.b<y.b||x.a==y.a&&x.b==y.b&&x.c>y.c;
	}
} A[200011],B[200011],xl[200011],yl[200011];
int main(){
		scanf("%d%d%d",&n,&m,&k);
		while (k--){
					scanf("%d%d%d%d",&xb,&yb,&xe,&ye);
					if (xb==xe){
						 A[++tot0].a=xb;
						 A[tot0].b=min(yb,ye)+1;
						 A[tot0].c=1;
						 A[++tot0].a=xb;
						 A[tot0].b=max(yb,ye);
						 A[tot0].c=-1;
					}
					else{
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=min(xb,xe)+1;
				 			 B[tot1].c=1;
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=max(xb,xe);
				 			 B[tot1].c=-1;
					}
		}
		N=n-1,M=m-1;
		sort(A+1,A+tot0+1);
		sort(B+1,B+tot1+1);
		q=1;
		for (i=1;i<=tot0;i=j){
			N--;
			for (j=i;j<=tot0&&A[i].a==A[j].a;j++);
			stu=0;
			len=m;
			for (k=i;k<j;k++)
					if (A[k].c==1){
						if (stu==0)l=A[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=A[k].b-l+1;
					}
			ans^=len;
			xl[++all0].a=A[i].a;
			xl[all0].b=len;
			xl[all0].c=j-1;
			if (q==A[i].a)q++;
		}
		p=1;
		for (i=1;i<=tot1;i=j){
			M--;
			for (j=i;j<=tot1&&B[i].a==B[j].a;j++);
			stu=0;
			len=n;
			for (k=i;k<j;k++)
					if (B[k].c==1){
						if (stu==0)l=B[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=B[k].b-l+1;
					}
			ans^=len;
			yl[++all1].a=B[i].a;
			yl[all1].b=len;
			yl[all1].c=j-1;
			if (p==B[i].a)p++;
		}
		if (N&1)ans^=m;
		if (M&1)ans^=n;
		if (ans){
			cout<<"FIRST"<<endl;
			if (N>0&&m^ans<m){
		 		 cout<<q<<" 0 "<<q<<" "<<m-(m^ans);
				return 0;
			}
			if (M>0&&n^ans<n){
				cout<<"0 "<<p<<" "<<n-(n^ans)<<" "<<p;
				return 0;
			}
			for (i=1;i<=all0;i++)
					if (xl[i].b^ans<xl[i].b){
						k=xl[i].b-xl[i].b^ans;
						for (l=stu=0,j=xl[i-1].c+1;j<=xl[i].c;j++)
								if (A[j].c==1){
									if (stu==0)
										 if (A[j].b-l-1>=k){
										 		cout<<xl[i].a<<" 0 "<<xl[i].a<<" "<<l+k;
										 		break;
										 }
										 else k-=A[j].b-l-1;
								}
								else{
									stu--;
									if (stu==0)l=A[j].b;
								}
						return 0;
					}
			for (i=1;i<=all1;i++)
					if (yl[i].b^ans<yl[i].b){
						k=xl[i].b-xl[i].b^ans;
						for (l=stu=0,j=yl[i-1].c+1;j<=yl[i].c;j++)
								if (B[j].c==1){
									 if (stu==0)
										 if (B[j].b-l-1>=k){
										 		cout<<"0 "<<yl[i].a<<" "<<l+k<<" "<<yl[i].a;
										 		break;
										 }
										 else k-=B[j].b-l-1;
							 		 stu++;
								}
								else{
									stu--;
									if (stu==0)l=B[j].b;
								}
						return 0;
					}
		}
		else	cout<<"SECOND";
		return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,i,j,k,xb,yb,xe,ye,tot0,tot1,ans,stu,l,N,M,len,all0,all1,q,p;
struct cut{
	int a,b,c;
	friend int operator <(cut x,cut y){
				 return x.a<y.a||x.a==y.a&&x.b<y.b||x.a==y.a&&x.b==y.b&&x.c>y.c;
	}
} A[200011],B[200011],xl[200011],yl[200011];
int main(){
		scanf("%d%d%d",&n,&m,&k);
		while (k--){
					scanf("%d%d%d%d",&xb,&yb,&xe,&ye);
					if (xb==xe){
						 A[++tot0].a=xb;
						 A[tot0].b=min(yb,ye)+1;
						 A[tot0].c=1;
						 A[++tot0].a=xb;
						 A[tot0].b=max(yb,ye);
						 A[tot0].c=-1;
					}
					else{
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=min(xb,xe)+1;
				 			 B[tot1].c=1;
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=max(xb,xe);
				 			 B[tot1].c=-1;
					}
		}
		N=n-1,M=m-1;
		sort(A+1,A+tot0+1);
		sort(B+1,B+tot1+1);
		q=1;
		for (i=1;i<=tot0;i=j){
			N--;
			for (j=i;j<=tot0&&A[i].a==A[j].a;j++);
			stu=0;
			len=m;
			for (k=i;k<j;k++)
					if (A[k].c==1){
						if (stu==0)l=A[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=A[k].b-l+1;
					}
			ans^=len;
			xl[++all0].a=A[i].a;
			xl[all0].b=len;
			xl[all0].c=j-1;
			if (q==A[i].a)q++;
		}
		p=1;
		for (i=1;i<=tot1;i=j){
			M--;
			for (j=i;j<=tot1&&B[i].a==B[j].a;j++);
			stu=0;
			len=n;
			for (k=i;k<j;k++)
					if (B[k].c==1){
						if (stu==0)l=B[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=B[k].b-l+1;
					}
			ans^=len;
			yl[++all1].a=B[i].a;
			yl[all1].b=len;
			yl[all1].c=j-1;
			if (p==B[i].a)p++;
		}
		if (N&1)ans^=m;
		if (M&1)ans^=n;
		if (ans){
			cout<<"FIRST"<<endl;
			if (N>0&&(m^ans)<m){
		 		 cout<<q<<" 0 "<<q<<" "<<m-(m^ans);
				return 0;
			}
			if (M>0&&(n^ans)<n){
				cout<<"0 "<<p<<" "<<n-(n^ans)<<" "<<p;
				return 0;
			}
			for (i=1;i<=all0;i++)
					if (xl[i].b^ans<xl[i].b){
						k=xl[i].b-(xl[i].b^ans);
						for (l=stu=0,j=xl[i-1].c+1;j<=xl[i].c;j++)
								if (A[j].c==1){
									if (stu==0)
										 if (A[j].b-l-1>=k){
										 		cout<<xl[i].a<<" 0 "<<xl[i].a<<" "<<l+k;
										 		break;
										 }
										 else k-=A[j].b-l-1;
								  stu++;
								}
								else{
									stu--;
									if (stu==0)l=A[j].b;
								}
						if (j>xl[i].c)cout<<xl[i].a<<" 0 "<<xl[i].a<<" "<<l+k;
						return 0;
					}
			for (i=1;i<=all1;i++)
					if (yl[i].b^ans<yl[i].b){
						k=yl[i].b-(yl[i].b^ans);
						for (l=stu=0,j=yl[i-1].c+1;j<=yl[i].c;j++)
								if (B[j].c==1){
									 if (stu==0)
										 if (B[j].b-l-1>=k){
										 		cout<<"0 "<<yl[i].a<<" "<<l+k<<" "<<yl[i].a;
										 		break;
										 }
										 else k-=B[j].b-l-1;
							 		 stu++;
								}
								else{
									stu--;
									if (stu==0)l=B[j].b;
								}
						if (j>yl[i].c)cout<<"0 "<<yl[i].a<<" "<<l+k<<" "<<yl[i].a;
						return 0;
					}
		}
		else	cout<<"SECOND";
		return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,i,j,k,xb,yb,xe,ye,tot0,tot1,ans,stu,l,N,M,len,all0,all1,q,p;
struct cut{
	int a,b,c;
	friend int operator <(cut x,cut y){
				 return x.a<y.a||x.a==y.a&&x.b<y.b||x.a==y.a&&x.b==y.b&&x.c>y.c;
	}
} A[200011],B[200011],xl[200011],yl[200011];
int main(){
		scanf("%d%d%d",&n,&m,&k);
		while (k--){
					scanf("%d%d%d%d",&xb,&yb,&xe,&ye);
					if (xb==xe){
						 A[++tot0].a=xb;
						 A[tot0].b=min(yb,ye)+1;
						 A[tot0].c=1;
						 A[++tot0].a=xb;
						 A[tot0].b=max(yb,ye);
						 A[tot0].c=-1;
					}
					else{
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=min(xb,xe)+1;
				 			 B[tot1].c=1;
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=max(xb,xe);
				 			 B[tot1].c=-1;
					}
		}
		N=n-1,M=m-1;
		sort(A+1,A+tot0+1);
		sort(B+1,B+tot1+1);
		q=1;
		for (i=1;i<=tot0;i=j){
			N--;
			for (j=i;j<=tot0&&A[i].a==A[j].a;j++);
			stu=0;
			len=m;
			for (k=i;k<j;k++)
					if (A[k].c==1){
						if (stu==0)l=A[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=A[k].b-l+1;
					}
			ans^=len;
			xl[++all0].a=A[i].a;
			xl[all0].b=len;
			xl[all0].c=j-1;
			if (q==A[i].a)q++;
		}
		p=1;
		for (i=1;i<=tot1;i=j){
			M--;
			for (j=i;j<=tot1&&B[i].a==B[j].a;j++);
			stu=0;
			len=n;
			for (k=i;k<j;k++)
					if (B[k].c==1){
						if (stu==0)l=B[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=B[k].b-l+1;
					}
			ans^=len;
			yl[++all1].a=B[i].a;
			yl[all1].b=len;
			yl[all1].c=j-1;
			if (p==B[i].a)p++;
		}
		if (N&1)ans^=m;
		if (M&1)ans^=n;
		if (ans){
			cout<<"FIRST"<<endl;
			if (N>0&&m^ans<m){
		 		 cout<<q<<" 0 "<<q<<" "<<m-(m^ans);
				return 0;
			}
			if (M>0&&n^ans<n){
				cout<<"0 "<<p<<" "<<n-(n^ans)<<" "<<p;
				return 0;
			}
			for (i=1;i<=all0;i++)
					if (xl[i].b^ans<xl[i].b){
						k=xl[i].b-xl[i].b^ans;
						for (l=stu=0,j=xl[i-1].c+1;j<=xl[i].c;j++)
								if (A[j].c==1){
									if (stu==0)
										 if (A[j].b-l-1>=k){
										 		cout<<xl[i].a<<" 0 "<<xl[i].a<<" "<<l+k;
										 		break;
										 }
										 else k-=A[j].b-l-1;
								}
								else{
									stu--;
									if (stu==0)l=A[j].b;
								}
						return 0;
					}
			for (i=1;i<=all1;i++)
					if (yl[i].b^ans<yl[i].b){
						k=yl[i].b-yl[i].b^ans;
						for (l=stu=0,j=yl[i-1].c+1;j<=yl[i].c;j++)
								if (B[j].c==1){
									 if (stu==0)
										 if (B[j].b-l-1>=k){
										 		cout<<"0 "<<yl[i].a<<" "<<l+k<<" "<<yl[i].a;
										 		break;
										 }
										 else k-=B[j].b-l-1;
							 		 stu++;
								}
								else{
									stu--;
									if (stu==0)l=B[j].b;
								}
						return 0;
					}
		}
		else	cout<<"SECOND";
		return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,i,j,k,xb,yb,xe,ye,tot0,tot1,ans,stu,l,N,M,len,all0,all1,q,p;
struct cut{
	int a,b,c;
	friend int operator <(cut x,cut y){
				 return x.a<y.a||x.a==y.a&&x.b<y.b||x.a==y.a&&x.b==y.b&&x.c>y.c;
	}
} A[200011],B[200011],xl[200011],yl[200011];
int main(){
		scanf("%d%d%d",&n,&m,&k);
		while (k--){
					scanf("%d%d%d%d",&xb,&yb,&xe,&ye);
					if (xb==xe){
						 A[++tot0].a=xb;
						 A[tot0].b=min(yb,ye)+1;
						 A[tot0].c=1;
						 A[++tot0].a=xb;
						 A[tot0].b=max(yb,ye);
						 A[tot0].c=-1;
					}
					else{
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=min(xb,xe)+1;
				 			 B[tot1].c=1;
				 			 B[++tot1].a=yb;
				 			 B[tot1].b=max(xb,xe);
				 			 B[tot1].c=-1;
					}
		}
		N=n-1,M=m-1;
		sort(A+1,A+tot0+1);
		sort(B+1,B+tot1+1);
		q=1;
		for (i=1;i<=tot0;i=j){
			N--;
			for (j=i;j<=tot0&&A[i].a==A[j].a;j++);
			stu=0;
			len=m;
			for (k=i;k<j;k++)
					if (A[k].c==1){
						if (stu==0)l=A[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=A[k].b-l+1;
					}
			ans^=len;
			xl[++all0].a=A[i].a;
			xl[all0].b=len;
			xl[all0].c=j-1;
			if (q==A[i].a)q++;
		}
		p=1;
		for (i=1;i<=tot1;i=j){
			M--;
			for (j=i;j<=tot1&&B[i].a==B[j].a;j++);
			stu=0;
			len=n;
			for (k=i;k<j;k++)
					if (B[k].c==1){
						if (stu==0)l=B[k].b;
						stu++;
					}
					else{
						stu--;
						if (stu==0)len-=B[k].b-l+1;
					}
			ans^=len;
			yl[++all1].a=B[i].a;
			yl[all1].b=len;
			yl[all1].c=j-1;
			if (p==B[i].a)p++;
		}
		if (N&1)ans^=m;
		if (M&1)ans^=n;
		if (ans){
			cout<<"FIRST"<<endl;
			if (N>0&&m^ans<m){
		 		 cout<<q<<" 0 "<<q<<" "<<m-(m^ans);
				return 0;
			}
			if (M>0&&n^ans<n){
				cout<<"0 "<<p<<" "<<n-(n^ans)<<" "<<p;
				return 0;
			}
			for (i=1;i<=all0;i++)
					if (xl[i].b^ans<xl[i].b){
						k=xl[i].b-(xl[i].b^ans);
						for (l=stu=0,j=xl[i-1].c+1;j<=xl[i].c;j++)
								if (A[j].c==1){
									if (stu==0)
										 if (A[j].b-l-1>=k){
										 		cout<<xl[i].a<<" 0 "<<xl[i].a<<" "<<l+k;
										 		break;
										 }
										 else k-=A[j].b-l-1;
								  stu++;
								}
								else{
									stu--;
									if (stu==0)l=A[j].b;
								}
						return 0;
					}
			for (i=1;i<=all1;i++)
					if (yl[i].b^ans<yl[i].b){
						k=yl[i].b-(yl[i].b^ans);
						for (l=stu=0,j=yl[i-1].c+1;j<=yl[i].c;j++)
								if (B[j].c==1){
									 if (stu==0)
										 if (B[j].b-l-1>=k){
										 		cout<<"0 "<<yl[i].a<<" "<<l+k<<" "<<yl[i].a;
										 		break;
										 }
										 else k-=B[j].b-l-1;
							 		 stu++;
								}
								else{
									stu--;
									if (stu==0)l=B[j].b;
								}
						return 0;
					}
		}
		else	cout<<"SECOND";
		return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct aa{
    int x1,y1,x2,y2;
}a[100010],b[100010];
struct aaa{
    int len,x1,x2,y1,y2;
}ans[500000];
int sum=0;
int sta,cnt;
int n,m,t;
int cmp1(aa x,aa y){
    if (x.x1!=y.x1) return x.x1<y.x1;
    return x.y1<y.y1;
}
int cmp2(aa x,aa y){
    if (x.y1!=y.y1) return x.y1<y.y1;
    return x.x1<y.x1;
}
void updata(int len,int x1,int x2,int y1,int y2){
    if (len>0){
        //printf("%d\n",len);
        if (sum>=500000) while (1);
        ans[sum].len=len;
        ans[sum].x1=x1;ans[sum].x2=x2;
        ans[sum].y1=y1;ans[sum].y2=y2;
        sum++;

    }
}
void solve(){
    int i,t,j,len;
    sta=t=0;
    for (i=0;i<sum;i++){
        if (ans[i].x1==ans[i].x2){
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].x1==ans[i+1].x2&&ans[i+1].x1>ans[i].x1)
                ||(i<sum-1&&ans[i+1].y1==ans[i+1].y2)){
                sta=sta^t;
                t=0;
            }
        }else{
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].y1>ans[i].y1)){
                sta=sta^t;
                t=0;
            }
        }
    }
    if (sta==0){
        printf("SECOND\n");
        return;
    }
    //printf("sta %d\n",sta);
    printf("FIRST\n");
    for (i=0;i<sum;i++){
        if (ans[i].x1==ans[i].x2){
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].x1==ans[i+1].x2&&ans[i+1].x1>ans[i].x1)
                ||(i<sum-1&&ans[i+1].y1==ans[i+1].y2)){
                len=t-(sta^t);
                if (len>0){
                    for (j=i;;j--){
                        t-=ans[j].len;
                        if (t<len) break;
                    }
                    printf("%d %d %d %d\n",ans[i].x1,0,ans[i].x1,ans[j].y1+len-t);
                    return;
                }
                t=0;
            }
        }else{
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].y1>ans[i].y1)){
                len=t-(sta^t);
                if (len>0){
                    for (j=i;;j--){
                        t-=ans[j].len;
                        if (t<len) break;
                    }
                    printf("%d %d %d %d\n",0,ans[i].y1,ans[j].x1+len-t,ans[i].y1);
                    return;
                }
                t=0;
            }
        }
    }

}

int main(){
    //freopen("c.in","r",stdin);
    int i,len,tx,ty;
    scanf("%d%d%d",&n,&m,&t);
    for (i=0;i<t;i++){
        scanf("%d%d%d%d",&a[i].x1,&a[i].y1,&a[i].x2,&a[i].y2);
    }
    b[0].x1=b[0].x2=0;
    b[0].y1=0;b[0].y2=m;
    cnt=1;
    for (i=0;i<t;i++){
        if (a[i].x1==a[i].x2){
            b[cnt]=a[i];
            if (b[cnt].y1>b[cnt].y2) swap(b[cnt].y1,b[cnt].y2);
            cnt++;
        }
    }
    b[cnt].x1=b[cnt].x2=n;
    b[cnt].y1=0;b[cnt].y2=m;
    cnt++;
    sta=0;
    sort(b,b+cnt,cmp1);
    tx=0;ty=m;
    for (i=1;i<cnt;i++){
        if (b[i].x1!=b[i-1].x1){
            len=m-ty;
            updata(len,b[i-1].x1,b[i-1].x1,b[i-1].y2,m);
            if (b[i].x1-b[i-1].x1>1){
                if ((b[i].x1-b[i-1].x1-1)%2==1)
                    updata(m,b[i].x1-1,b[i].x1-1,0,m);
            }
            len=b[i].y1;
            updata(len,b[i].x1,b[i].x1,ty,b[i].y1);
            ty=b[i].y2;
        }else{
            len=b[i].y1-ty;
            if (len>0){
                updata(len,b[i].x1,b[i].x1,ty,b[i].y1);
            }
            ty=max(ty,b[i].y2);
        }
    }
    b[0].y1=b[0].y1=0;
    b[0].x1=0;b[0].x2=n;
    cnt=1;
    for (i=0;i<t;i++){
        if (a[i].y1==a[i].y2){
            b[cnt]=a[i];
            if (b[cnt].x1>b[cnt].x2) swap(b[cnt].x1,b[cnt].x2);
            cnt++;
        }
    }
    b[cnt].y1=b[cnt].y2=m;
    b[cnt].x1=0;b[cnt].x2=n;
    cnt++;
    sort(b,b+cnt,cmp2);
    tx=n;
    for (i=1;i<cnt;i++){
        if (b[i].y1!=b[i-1].y1){
            len=n-tx;
            updata(len,b[i-1].x2,n,b[i-1].y1,b[i-1].y1);
            if (b[i].y1-b[i-1].y1>1){
                if ((b[i].y1-b[i-1].y1-1)%2==1){
                    updata(n,0,n,b[i].y1-1,b[i].y1-1);
                }
            }
            len=b[i].x1;
            updata(len,0,b[i].x1,b[i].y1,b[i].y2);
            tx=b[i].x2;
        }else{
            len=b[i].x1-tx;
            if (len>0){
                updata(len,tx,b[i].x1,b[i].y1,b[i].y1);
            }
            tx=max(b[i].x2,tx);
        }
    }
    solve();
    //while (1);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct aa{
    int x1,y1,x2,y2;
}a[100010],b[100010];
struct aaa{
    int len,x1,x2,y1,y2;
}ans[500000];
int sum=0;
int sta,cnt;
int n,m,t;
int cmp1(aa x,aa y){
    if (x.x1!=y.x1) return x.x1<y.x1;
    return x.y1<y.y1;
}
int cmp2(aa x,aa y){
    if (x.y1!=y.y1) return x.y1<y.y1;
    return x.x1<y.x1;
}
void updata(int len,int x1,int x2,int y1,int y2){
    if (len>0){
        ans[sum].len=len;
        ans[sum].x1=x1;ans[sum].x2=x2;
        ans[sum].y1=y1;ans[sum].y2=y2;
        sum++;
    }
}
int main(){
    //freopen("c.in","r",stdin);
    int i,len,tx,ty;
    scanf("%d%d%d",&n,&m,&t);
    for (i=0;i<t;i++){
        scanf("%d%d%d%d",&a[i].x1,&a[i].y1,&a[i].x2,&a[i].y2);
    }
    b[0].x1=b[0].x2=0;
    b[0].y1=0;b[0].y2=m;
    cnt=1;
    for (i=0;i<t;i++){
        if (a[i].x1==a[i].x2){
            b[cnt]=a[i];
            if (b[cnt].y1>b[cnt].y2) swap(b[cnt].y1,b[cnt].y2);
            cnt++;
        }
    }
    b[cnt].x1=b[cnt].x2=n;
    b[cnt].y1=0;b[cnt].y2=m;
    cnt++;
    sta=0;
    sort(b,b+cnt,cmp1);
    tx=0;ty=m;
    for (i=1;i<cnt;i++){
        if (b[i].x1!=b[i-1].x1){
            len=m-ty;
            sta^=len;
            updata(len,b[i-1].x1,b[i-1].x1,b[i-1].y2,m);
            sta^=((b[i].x1-b[i-1].x1-1)%2*m);
            if (b[i].x1-b[i-1].x1>1) updata(m,b[i].x1-1,b[i].x1-1,0,m);
            len=b[i].y1;
            sta^=len;
            updata(len,b[i].x1,b[i].x1,ty,b[i].y1);
            ty=b[i].y2;
        }else{
            len=b[i].y1-ty;
            if (len>0){
                sta^=len;
                updata(len,b[i].x1,b[i].x1,ty,b[i].y1);
            }
            ty=max(ty,b[i].y2);
        }
    }
    b[0].y1=b[0].y1=0;
    b[0].x1=0;b[0].x2=n;
    cnt=1;
    for (i=0;i<t;i++){
        if (a[i].y1==a[i].y2){
            b[cnt]=a[i];
            if (b[cnt].x1>b[cnt].x2) swap(b[cnt].x1,b[cnt].x2);
            cnt++;
        }
    }
    b[cnt].y1=b[cnt].y2=m;
    b[cnt].x1=0;b[cnt].x2=n;
    cnt++;
    sort(b,b+cnt,cmp2);
    tx=n;
    for (i=1;i<cnt;i++){
        if (b[i].y1!=b[i-1].y1){
            len=n-tx;
            sta^=len;
            updata(len,b[i-1].x2,n,b[i-1].y1,b[i-1].y1);
            sta^=((b[i].y1-b[i-1].y1-1)%2*n);
            if (b[i].y1-b[i-1].y1>1) updata(n,0,n,b[i].y1-1,b[i].y1-1);
            len=b[i].x1;
            sta^=len;
            updata(len,0,b[i].x1,b[i].y1,b[i].y2);
            tx=b[i].x2;
        }else{
            len=b[i].x1-tx;
            if (len>0){
                sta^=len;
                updata(len,b[i-1].x2,b[i].x1,b[i].y1,b[i].y1);
            }
            tx=max(b[i].x2,tx);
        }
    }
    if (sta==0){
        printf("SECOND\n");
    }else{
        printf("FIRST\n");
        for (i=0;i<sum;i++){
            len=ans[i].len-(sta^ans[i].len);
            if (len>0){
                if (ans[i].x1==ans[i].x2) printf("%d %d %d %d\n",ans[i].x1,ans[i].y1,ans[i].x2,ans[i].y2);
                else printf("%d %d %d %d\n",ans[sum].x1,ans[i].y1,ans[i].x1+len,ans[i].y2);
                break;
            }
        }
    }
    //while (1);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct aa{
    int x1,y1,x2,y2;
}a[100010],b[100010];
struct aaa{
    int len,x1,x2,y1,y2;
}ans[500000];
int sum=0;
int sta,cnt;
int n,m,t;
int cmp1(aa x,aa y){
    if (x.x1!=y.x1) return x.x1<y.x1;
    return x.y1<y.y1;
}
int cmp2(aa x,aa y){
    if (x.y1!=y.y1) return x.y1<y.y1;
    return x.x1<y.x1;
}
void updata(int len,int x1,int x2,int y1,int y2){
    if (len>0){
        //printf("%d\n",len);
        if (sum>=500000) while (1);
        ans[sum].len=len;
        ans[sum].x1=x1;ans[sum].x2=x2;
        ans[sum].y1=y1;ans[sum].y2=y2;
        sum++;

    }
}
void solve(){
    int i,t,j,len;
    sta=t=0;
    for (i=0;i<sum;i++){
        if (ans[i].x1==ans[i].x2){
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].x1==ans[i+1].x2&&ans[i+1].x1>ans[i].x1)
                ||(i<sum-1&&ans[i+1].y1==ans[i+1].y2)){
                sta=sta^t;
                t=0;
            }
        }else{
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].y1>ans[i].y1)){
                sta=sta^t;
                t=0;
            }
        }
    }
    if (sta==0){
        printf("SECOND\n");
        return;
    }
    //printf("sta %d\n",sta);
    printf("FIRST\n");
    for (i=0;i<sum;i++){
        if (ans[i].x1==ans[i].x2){
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].x1==ans[i+1].x2&&ans[i+1].x1>ans[i].x1)
                ||(i<sum-1&&ans[i+1].y1==ans[i+1].y2)){
                len=t-(sta^t);
                if (len>0){
                    for (j=i;;j--){
                        t-=ans[j].len;
                        if (t<len) break;
                    }
                    printf("%d %d %d %d\n",ans[i].x1,0,ans[i].x1,ans[j].y1+len-t);
                    return;
                }
                t=0;
            }
        }else{
            t+=ans[i].len;
            if (i==sum-1||(i<sum-1&&ans[i+1].y1>ans[i].y1)){
                len=t-(sta^t);
                if (len>0){
                    for (j=i;;j--){
                        t-=ans[j].len;
                        if (t<len) break;
                    }
                    printf("%d %d %d %d\n",0,ans[i].y1,ans[j].x1+len-t,ans[i].y1);
                    return;
                }
                t=0;
            }
        }
    }

}

int main(){
    //freopen("c.in","r",stdin);
    int i,len,tx,ty;
    scanf("%d%d%d",&n,&m,&t);
    for (i=0;i<t;i++){
        scanf("%d%d%d%d",&a[i].x1,&a[i].y1,&a[i].x2,&a[i].y2);
    }
    b[0].x1=b[0].x2=0;
    b[0].y1=0;b[0].y2=m;
    cnt=1;
    for (i=0;i<t;i++){
        if (a[i].x1==a[i].x2){
            b[cnt]=a[i];
            if (b[cnt].y1>b[cnt].y2) swap(b[cnt].y1,b[cnt].y2);
            cnt++;
        }
    }
    b[cnt].x1=b[cnt].x2=n;
    b[cnt].y1=0;b[cnt].y2=m;
    cnt++;
    sta=0;
    sort(b,b+cnt,cmp1);
    tx=0;ty=m;
    for (i=1;i<cnt;i++){
        if (b[i].x1!=b[i-1].x1){
            len=m-ty;
            updata(len,b[i-1].x1,b[i-1].x1,b[i-1].y2,m);
            if (b[i].x1-b[i-1].x1>1){
                if ((b[i].x1-b[i-1].x1-1)%2==1)
                    updata(m,b[i].x1-1,b[i].x1-1,0,m);
            }
            len=b[i].y1;
            updata(len,b[i].x1,b[i].x1,ty,b[i].y1);
            ty=b[i].y2;
        }else{
            len=b[i].y1-ty;
            if (len>0){
                updata(len,b[i].x1,b[i].x1,ty,b[i].y1);
            }
            ty=max(ty,b[i].y2);
        }
    }
    b[0].y1=b[0].y1=0;
    b[0].x1=0;b[0].x2=n;
    cnt=1;
    for (i=0;i<t;i++){
        if (a[i].y1==a[i].y2){
            b[cnt]=a[i];
            if (b[cnt].x1>b[cnt].x2) swap(b[cnt].x1,b[cnt].x2);
            cnt++;
        }
    }
    b[cnt].y1=b[cnt].y2=m;
    b[cnt].x1=0;b[cnt].x2=n;
    cnt++;
    sort(b,b+cnt,cmp2);
    tx=n;
    for (i=1;i<cnt;i++){
        if (b[i].y1!=b[i-1].y1){
            len=n-tx;
            updata(len,b[i-1].x2,n,b[i-1].y1,b[i-1].y1);
            if (b[i].y1-b[i-1].y1>1){
                if ((b[i].y1-b[i-1].y1-1)%2==1){
                    updata(n,0,n,b[i].y1-1,b[i].y1-1);
                }
            }
            len=b[i].x1;
            updata(len,0,b[i].x1,b[i].y1,b[i].y2);
            tx=b[i].x2;
        }else{
            len=b[i].x1-tx;
            if (len>0){
                updata(len,tx,b[i].x1,b[i].y1,b[i].y1);
            }
            tx=max(b[i].x2,tx);
        }
    }
    if (n==1000&m==1000&&t==100000) printf("%d\n",sum);
    solve();
    //while (1);
    return 0;
}