#include
#include
#include
using namespace std;
struct CD{
string name;
string singer;
int year;
int duration;
double cost;
};
signed main() {
int ans1 = 0,ans2 = 0;
int n;
cin >> n;
CD a1[n],a2[n];
for(int i = 0; i < n; i++)
cin >> a1[i].name >> a1[i].singer >> a1[i].year >> a1[i].duration >> a1[i].duration;
for(int i = 0; i < n; i++)
cin >> a2[i].name >> a2[i].singer >> a2[i].year >> a2[i].duration >> a2[i].duration;
for(auto i: a1)
ans1 += i.duration;
for(auto i: a2)
ans2 += i.duration;
cout << "1 collection durates: " << ans1 << "\n";</strong>
cout << "2 collection durates: " << ans2 << "\n";</strong>
cout << "both collections durate: " << ans1 + ans2 << "\n";</strong>
}