#include <stdio.h>

// Body構造体の定義
struct Body {
    int id;
    int weight;
    int height;
};

// swap関数の定義
void swap(struct Body *a, struct Body *b) {
    struct Body temp = *a;
    *a = *b;
    *b = temp;
}

// 構造体配列を身長の逆順に並べ替える関数
void sortByHeight(struct Body a[], int size) {
    for (int i = 0; i < size - 1; i++) {
        for (int j = i + 1; j < size; j++) {
            if (a[i].height < a[j].height) {
                swap(&a[i], &a[j]);
            }
        }
    }
}

int main(void) {
    // 構造体配列の初期化
    struct Body a[] = {
        {1, 65, 169},
        {2, 73, 170},
        {3, 59, 161},
        {4, 79, 175},
        {5, 55, 168}
    };
    int size = sizeof(a) / sizeof(a[0]);

    // 身長の逆順に並べ替える
    sortByHeight(a, size);

    // 結果を表示
    printf("ID  Weight  Height\n");
    for (int i = 0; i < size; i++) {
        printf("%d    %d    %d\n", a[i].id, a[i].weight, a[i].height);
    }

    return 0;
}
