#include <bits/stdc++.h>

using namespace std;

#define whole(xs) (xs).begin(),(xs).end()
#define uniq(xs) ((xs).erase(unique((xs).begin(), (xs).end()), (xs).end()))

namespace {

    const double EPS = 1e-8;

    bool EQ(double x, double y) {
        return abs(x - y) < EPS;
    }

    struct Point {
        double x, y;
        Point() {}
        Point(double x, double y) : x(x), y(y) {}
        Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
        Point operator-(const Point& p) const { return Point(x - p.x, y - p.y); }
        Point operator*(double k) const { return Point(k * x, k * y); }
        Point operator/(double k) const { return Point(x / k, y / k); }
    };
    double dot(const Point& a, const Point& b) { return a.x * b.x + a.y * b.y; }
    double cross(const Point& a, const Point& b) { return a.x * b.y - a.y * b.x; }
    double norm(const Point& a) { return sqrt(dot(a, a)); }
    Point rot90(const Point& p) { return Point(-p.y, p.x); } // 反時計回りに90度回転 
    double angle(const Point& a) { return atan2(a.y, a.x); } // x軸を反時計回りに何ラジアン回転させれば点aに乗るか
    ostream& operator<<(ostream& os, const Point& p) { return os << "(" << p.x << "," << p.y << ")"; }
    istream& operator>>(istream& is, Point& p) { return is >> p.x >> p.y; }
    bool operator==(const Point& a, const Point& b) { return EQ(a.x, b.x) && EQ(a.y, b.y); }
    bool operator!=(const Point& a, const Point& b) { return not(a == b); }
    bool operator<(const Point& a, const Point& b) { return EQ(a.x, b.x) ? a.y < b.y : a.x < b.x; }

    int ccw(Point a, Point b, Point c){
        b = b - a; c = c - a;
        if (cross(b, c) > EPS) return +1;      // a,b,cの順に反時計周り
        if (cross(b, c) < -EPS) return -1;     // a,b,cの順に時計周り
        if (dot(b, c) < 0) return +2;          // c--a--b 直線
        if (norm(b) < norm(c)) return -2;      // a--b--c 直線
        return 0;                              // a--c--b 直線
    }

    struct Segment {
        Point a, b;
        Segment() {}
        Segment(const Point& a, const Point& b) : a(a), b(b) {}
    };
    bool intersects(const Segment& s, const Segment& t) {
        return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
    }

    typedef Segment Line;

    Point projection(const Line& l, const Point& p) {
        Point u = (p - l.a), v = (l.b - l.a);
        return l.a + (v / norm(v)) * (dot(u, v) / norm(v));
    }

    Point reflection(const Line& l, const Point& p) {
        Point h = projection(l, p);
        return p + (h - p) * 2;
    }

    Point crosspoint(const Line& s, const Line& t) {
        double d = cross(t.b - t.a, s.b - s.a);
        assert(abs(d) >= EPS);
        return s.a + (s.b - s.a) * cross(t.b - t.a, t.b - s.a) / d;
    }

    struct UnionFind {
        int N;
        vector<int> P;
        UnionFind(int N) : N(N) {
            P.clear(); P.resize(N, -1);
        }
        int root(int x) {
            if (P[x] == -1) return x;
            return P[x] = root(P[x]);
        }
        int query(int x, int y) {
            return root(x) == root(y);
        }
        void merge(int x, int y) {
            x = root(x); y = root(y);
            if (x == y) return;
            P[x] = y;
        }
    };

    int N;
    vector<Segment> ss;
    bool input() {
        cin >> N;
        if (N == 0) return false;
        ss.clear(); ss.resize(N);
        for (int i = 0; i < N; i++) {
            cin >> ss[i].a >> ss[i].b;
        }
        return true;
    }

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "";
        os << vs[0];
        for (int i = 1; i < vs.size(); i++) os << " " << vs[i];
        return os;
    }

    map<string, int> M;

    void init() {
        M["440"] = 0; M["120"] = 1; M["560"] = -1;
        M["461"] = 3; M["351"] = 4; M["560"] = -1;
        M["561"] = 6; M["340"] = 7; M["562"] = 8;
        M["451"] = 9;
    }

    int guess2or5(const vector<Segment>& s) {
        map<Point, int> h;
        int nl = s.size();
        for (int i = 0; i < nl; i++) {
            h[s[i].a]++;
            h[s[i].b]++;
        }
        Point a, b, c;
        for (int i = 0; i < nl; i++) {
            if (h[s[i].a] == 1) { a = s[i].a; b = s[i].b; break; }
            else if (h[s[i].b] == 1) { a = s[i].b; b = s[i].a; break; }
        }
        for (int i = 0; i < nl; i++) {
            if (s[i].a == b && s[i].b != a) {
                c = s[i].b;
                break;
            }
            if (s[i].b == b && s[i].a != a) {
                c = s[i].a;
                break;
            }
        }
        int x = ccw(a, b, c);
        if (x == 1) return 5;
        if (x == -1) return 2;
        assert(false);
    }

    int guess(const vector<Segment>& s) {
        int nl = s.size();
        
        vector<Point> p1;
        vector<Point> p2;
        for (int i = 0; i < nl; i++) {
            p1.push_back(s[i].a);
            p1.push_back(s[i].b);
            for (int j = i + 1; j < nl; j++) {
                if (intersects(s[i], s[j])) {
                    Point x = crosspoint(s[i], s[j]);
                    if (not ((x == s[i].a || x == s[i].b) && (x == s[j].a || x == s[j].b)) ) {
                        p2.push_back(x);
                    }
                }
            }
        }
        sort(whole(p1)); uniq(p1);
        sort(whole(p2)); uniq(p2);
        vector<Point> ps; 
        ps.insert(ps.end(), whole(p1));
        ps.insert(ps.end(), whole(p2));
        sort(whole(ps)); uniq(ps);
        int np = ps.size();

        int nm = p2.size();

        string key;
        key.push_back(char(nl + '0'));
        key.push_back(char(np + '0'));
        key.push_back(char(nm + '0'));
        if (M[key] >= 0) {
            return M[key];
        } else {
            return guess2or5(s);
        }
    }

    void solve() {
        UnionFind uf(N);
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                if (intersects(ss[i], ss[j])) uf.merge(i, j);
            }
        }

        vector<int> ans(10, 0);
        vector<bool> used(N, false);
        for (int i = 0; i < N; i++) {
            if (used[i]) continue;
            vector<Segment> s;
            for (int j = 0; j < N; j++) {
                if (uf.query(i, j)) {
                    used[j] = true;
                    s.push_back(ss[j]);
                }
            }
            ans[guess(s)]++;
        }
        cout << ans << endl;
    }
}

int main() {
    init();
    while (input()) solve();
    return 0;
}

Measured memory_bytes: 1312