long getSalary(String[] relations, int i) {
		if (salary[i] > 0) {
			return salary[i];
		}
		long sum = 0;
		for (int j = 0; j < relations[i].length(); j++) {
			if (relations[i].charAt(j) == 'Y') {
				sum += getSalary(relations, j);
			}
		}

		if (sum == 0) {
			salary[i] = 1;
		} else {
			salary[i] = sum;
		}
		return salary[i];
	}