private static Vector<Vector<Integer>> gcdPaintLineHelper(Vector<Vector<Integer>> seg1, 
			Vector<Vector<Integer>> seg2) {
		int s1 = seg1.size(), s2 = seg2.size();
		if (s1 == 0) {
			return seg2;
		}
		if (s2 == 0) {
			return seg1;
		}
		
		// if size of first group of segments is bigger, then we attach segments from 
		// the second group onto the segments 
		// ex. if seg1: 7 segments of 2-3s, seg2: 3 segments of 3-2s
		//  at the end, we should have:
		//  seg1: 1 segment of 2, seg2: 3 segments of 3-2-2-3-2-3s
		if (s1 >= s2) {
			int numAttach = s1 / s2;
			for(int i=0; i<s2; i++) {
				for (int j=0; j<numAttach; j++) {
					seg2.get(i).addAll(seg1.remove(0));
				}
			}
		}
		
		// similar to above
		if (s1 < s2) {
			int numAttach = s2 / s1;
			for(int i=0; i<s1; i++) {
				for (int j=0; j<numAttach; j++) {
					seg1.get(i).addAll(seg2.remove(0));
				}
			}
		}
		
		return gcdPaintLineHelper(seg1, seg2);
	}