#include<stdio.h>
#include<malloc.h>

#define MAX_SIZE    100

void BubbleSort_high(int *array);
int getcount(int r_count, int g_count, int b_count);


int getcount(int r_count, int g_count, int b_count) {
    int count = 0;
    
    count += r_count;
    r_count -= count;
    g_count -= count;
    b_count -= count;

    if((b_count / 2) >= g_count) {
        count += g_count;
    }else {
        count += (b_count / 2);
    }

    return count;
}

int main(void) {
    int n;
    int i,j;
    int array[MAX_SIZE][3];

    scanf("%d", &n);
    for(i = 0; i < n; i++) {
        scanf("%d%d%d", &array[i][0],&array[i][1],&array[i][2]);
    }
//先对得到的每组三个数据排序,第一步找到最小的min3Num  所有的元素减去最小的元素, count = count + min3Num
//第二步最大的元素max除以2,和第二大的元素secondMax比较,若大于 count = count + secondMax
//max/2 <= secondMax, 那么就让count = count + max / 2;
//我还是不知道哪里有问题啊 心态炸了 好绝望啊 是我打扰贵公司了 打扰了
    for(i = 0; i < n; i++) {
        BubbleSort_high(array[i]);
        printf("%d\n", getcount(array[i][0], array[i][1], array[i][2]));
    }

    return 0;
}

想的是先找三个元素最小的 让三个元素都减去最小的,再让最大的除以二和次大的比较,