#include <stdio.h>

/* A peak in an array x at position i:                */
/*   x[i] > x[i-1]   and  x[i] > x[i+1]               */


 int isPeak(int values[], int len, int i);   /* put the necessary parameters here */
 void printPeak(int arr[], int position);


/* Read the data, report peaks, manipulate data, report peaks */
int main() {

int x[40];
int y[40];
int counter = 0;
int i;

/* Keith & Josh */
do {
scanf("%d",&x[counter]);
counter++;
} while(x[counter-1] != -1);

counter--;

/* Carson & Breanne*/

for (i = 0; i < counter; i++) {
   if (isPeak(x, counter, i) == 1) {
      printPeak(x, i);
   }
}

/* Robby & Peter are the best!*/

for (i= 0; i < counter; i++) {
   y[i] = x[i];
   if (isPeak(x, counter, i) == 1) {
       y[i] = y[i] * -1;
   }
}

printf("\n");

for (i = 0; i < counter; i++) {
   if (isPeak(y, counter, i) == 1) {
      printPeak(y, i);
   }
}

return 0;
}

/* isPeak()   checks if there is a peak at the given position */
/*            of an array                                     */

/* Jenny & Emil */

int isPeak(int values[], int len, int i) {
	if (i >= len - 1 || i < 1) {
		return 0;
	}
	return values[i] > values[i - 1] && values[i] > values[i + 1];

}

/* Carson & Breanne*/

void printPeak(int arr[], int position) {
   printf("Peak @ %d: %d -> %d <- %d\n", position, arr[position - 1], arr[position], arr[position + 1]);
}