import java.util.*;
class Solution {
public String[] solution(int[][] line) {
List<Long> xl = new ArrayList<>(); List<Long> yl = new ArrayList<>();
long xMax = Long.MIN_VALUE; long xMin = Long.MAX_VALUE;
long yMax = Long.MIN_VALUE; long yMin = Long.MAX_VALUE;
for(int i=0; i<line.length; i++) {
for(int j=0; j<i; j++) {
long a = line[i][0]; long b = line[i][1]; long e = line[i][2];
long c = line[j][0]; long d = line[j][1]; long f = line[j][2];
double x = (double)(b*f-e*d)/(a*d-b*c); double y = (double)(e*c-a*f)/(a*d-b*c);
if(check(x,y)) { xl.add((long)x); yl.add((long)y); }
}
}
for(int i=0; i<xl.size(); i++) {
xMax = Math.max(xMax, xl.get(i)); xMin = Math.min(xMin, xl.get(i));
yMax = Math.max(yMax, yl.get(i)); yMin = Math.min(yMin, yl.get(i));
}
String[] answer = new String[(int)(yMax-yMin+1)];
for(int i=0; i<answer.length; i++) {
answer[i] = "";
for(long j=xMin; j<=xMax; j++) { answer[i] += "."; }
}
for(int i=0; i<xl.size(); i++) {
int x = (int)(xl.get(i)-xMin); int y = (int)(yMax-yl.get(i));
StringBuilder sb = new StringBuilder(answer[y]);
sb.setCharAt(x, '*');
answer[y] = sb.toString();
}
return answer;
}
public boolean check(double x, double y) {
if(x==(long)x && y==(long)y) { return true; }
else { return false; }
}
}