#include #include #include #define N 100050 using namespace std; long long jilu[N]; long long af[N],bf[N]; int main() { int t; scanf("%d",&t); while(t--){ memset(bf,0,sizeof(bf)); memset(af,0,sizeof(af)); int n; scanf("%d",&n); long long ans=0; for(int i=1;i<=n;i++){ scanf("%I64d",jilu+i); if(i>1) bf[i]=max(bf[i-1],max(jilu[i]-jilu[i-1],jilu[i-1]-jilu[i])); } for(int i=n-1;i>=1;i--){ af[i]=max(af[i+1],max(jilu[i+1]-jilu[i],jilu[i]-jilu[i+1])); } ans+=af[2]; for(int i=2;i