A)
#include<iostream>
using namespace std;
struct copil {
char nume[51];
int inaltime;
}copii[101];
int n;
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> copii[i].nume >> copii[i].inaltime;
for (int i = 1; i <= n - 1; i++)
for (int j = i + 1; j <= n; j++)
if (copii[i].inaltime < copii[j].inaltime)
swap(copii[i], copii[j]);
for (int i = 1; i <= n; i++)
cout << copii[i].nume << ' ';
return 0;
}
B)
#include<iostream>
using namespace std;
int n, v[101];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> v[i];
for (int i = 1; i <= n - 1; i++)
for (int j = i + 1; j <= n; j++)
if (v[i] < v[j])
swap(v[i], v[j]);
cout << v[1] << ' ' << v[2] << ' ' << v[3];
return 0;
}