#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

typedef long double ld;
const ld PI = acos(-1.0);
bool eq(ld a, ld b) { return abs(a - b) < EPS; }
typedef complex<ld> Point;
typedef vector<Point> Polygon;

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

struct Line
{
	Point a, b;
	Line() {};
	Line(Point p, Point q) :a(p), b(q) {};
	Line(ld x1, ld y1, ld x2, ld y2) :a(Point(x1, y1)), b(Point(x2, y2)) {};
};

ld dot(Point a, Point b)
{
	return real(conj(a)*b);
}

ld cross(Point a, Point b)
{
	return imag(conj(a)*b);
}

int ccw(Point a, Point b, Point c)
{
	b -= a; c -= a;
	if (cross(b, c) > EPS) return 1;    //counter cloclwise
	if (cross(b, c) < -EPS) return -1;  //cloclwise
	if (dot(b, c) < 0) return 2;        //c--a--b on line 
	if (norm(b) < norm(c)) return -2;   //a--b--c on line
	return 0;                           //a--c--b on line
}

bool isis_ss(Line s, Line 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);
}

bool isis_sp(Line s, Point p)
{
	return (abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a)) < EPS;
}

int label(Line s, vector<Line> segments)
{
	int edge = 0, mid = 0;
	for (auto i : segments)
	{
		if (((s.a == i.a) && (s.b == i.b)) || !isis_ss(s, i)) continue;
		if (s.a == i.a || s.a == i.b || s.b == i.a || s.b == i.b) edge++;
		else if (isis_sp(i, s.a) || isis_sp(i, s.b)) mid++;
	}
	if (edge == 2 && mid == 0) return 0;
	if (edge == 0 && mid == 0) return 1;
	if (edge == 1 && mid == 0) return 2;
	if (edge == 0 && mid == 1) return 3;
	if (edge == 1 && mid == 1) return 4;
	if (edge == 0 && mid == 2) return 5;
	assert(false);
}

int ident(vi v)
{
	vector<vi> lis(10);
	lis[0] = { 4,0,0,0,0,0 };
	lis[1] = { 0,1,0,0,0,0 };
	lis[2] = { 3,0,2,0,0,0 };
	lis[3] = { 1,0,2,1,0,0 };
	lis[4] = { 0,1,1,0,1,0 };
	lis[5] = { 3,0,2,0,0,0 };
	lis[6] = { 3,0,1,0,1,0 };
	lis[7] = { 1,0,2,0,0,0 };
	lis[8] = { 4,0,0,0,0,1 };
	lis[9] = { 2,0,1,0,1,0 };
	REP(i, 10)
	{
		if (v == lis[i]) return i;
	}
	assert(false);
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n;
	while (cin >> n, n)
	{
		vector<Line> seg;
		REP(i, n)
		{
			ld a, b, c, d;
			cin >> a >> b >> c >> d;
			seg.emplace_back(a, b, c, d);
		}
		vector<vi> g(n);
		REP(i, n)REP(j, n)
		{
			if (i == j) continue;
			if (isis_ss(seg[i], seg[j]))
			{
				g[i].push_back(j);
				g[j].push_back(i);
			}
		}
		vector<vi> group;
		vector<bool> vis(n);
		REP(i, n)
		{
			if (vis[i]) continue;
			vi tmp;
			vis[i] = true;
			queue<int> que;
			que.push(i);
			tmp.push_back(i);
			while (!que.empty())
			{
				int t = que.front();
				que.pop();
				for (auto j : g[t])
				{
					if (vis[j]) continue;
					vis[j] = true;
					que.push(j);
					tmp.push_back(j);
				}
			}
			group.push_back(tmp);
		}
		vi ans(10);
		for (auto i : group)
		{
			vector<Line> segments;
			for (auto j : i) segments.push_back(seg[j]);
			vi types(6);
			for (auto j : segments)
			{
				int t = label(j, segments);
				types[t]++;
			}
			int res = ident(types);
			if (res == 2)
			{
				Line a, b;
				for (auto j : segments)
				{
					if (label(j, segments) == 2) a = j;
				}
				for (auto j : segments)
				{
					if ((a.a == j.a) && (a.b == j.b)) continue;
					if (isis_ss(a, j)) b = j;
				}
				Point p, q, r;
				if (a.a == b.a)
				{
					p = a.b, q = a.a, r = b.b;
				}
				if (a.a == b.b)
				{
					p = a.b, q = a.a, r = b.a;
				}
				if (a.b == b.a)
				{
					p = a.a, q = a.b, r = b.b;
				}
				if (a.b == b.b)
				{
					p = a.a, q = a.b, r = b.a;
				}
				if (ccw(p, q, r) == 1) res = 5;
				else if (ccw(p, q, r) == -1) res = 2;
			}
			ans[res]++;
		}
		REP(i, 10) cout << ans[i] << (i == 9 ? "\n" : " ");
	}
	return 0;
}

Measured memory_bytes: 3468