#include <iostream>
#include <climits>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int buffer[3] = {0, 0, 0};
int previousMinAnswer[3] = {0, 0, 0};
int minAnswer[3] = {0, 0, 0};
int previousMaxAnswer[3] = {0, 0, 0};
int maxAnswer[3] = {0, 0, 0};
for (auto i=0; i<n; i++) {
for (auto j=0; j<3; j++){
cin >> buffer[j];
}
minAnswer[0] = buffer[0] + min(previousMinAnswer[0], previousMinAnswer[1]);
minAnswer[1] = buffer[1] + min(min(previousMinAnswer[0], previousMinAnswer[1]), previousMinAnswer[2]);
minAnswer[2] = buffer[2] + min(previousMinAnswer[2], previousMinAnswer[1]);
maxAnswer[0] = buffer[0] + max(previousMaxAnswer[0], previousMaxAnswer[1]);
maxAnswer[1] = buffer[1] + max(max(previousMaxAnswer[0], previousMaxAnswer[1]), previousMaxAnswer[2]);
maxAnswer[2] = buffer[2] + max(previousMaxAnswer[2], previousMaxAnswer[1]);
for (auto j=0; j<3; j++){
previousMinAnswer[j] = minAnswer[j];
previousMaxAnswer[j] = maxAnswer[j];
}
}
cout << *max_element(maxAnswer, maxAnswer + 3) << ' ';
cout << *min_element(minAnswer, minAnswer + 3);
return 0;
}