#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
 #define MAX 1000
 typedef struct{
     int taskID;
     int priority;
 }Task;
 Task heap[MAX + 1];
 int heapSize = 0;
 void swap(Task *a,Task *b){
     Task temp = *a;
     *a = *b;
     *b = temp;
 }
 void insert (Task t){
     heap[++heapSize]=t;
     int=heapSize;
     while (i>1 && heap[i].priyority< heap[i/2].priority){
         swap (&heap [i],&heap[i/2]);
         i /= 2;
     }
 }
 Task getHighestPriority() {
     return heap[1];
 }
 int main() {
     int n;
     if (scanf("%d",&n)!=1||n < 1||n>1000){
         printf("Invalid input\n");
         return 0;
     }
     for (int i=0;i<n;i++){
         int taskID,priority;
         char line[100];
     
     if (scanf("%[\n]",line !=1){
     printf("Invalid input \n");
     continue;
 }
 if(scanf(line,"%d %d",&taskID,&priyority) !=2){
     printf ("Invalid input\n");
     continue;
 }
 Task t;
 t.taskID = taskID;
 t.priyority = priyority;
 insert(t);
 
 printf("TaskAdded: %d\n",taskID);
     }
     if (heapSize > 0){
         Task top = getHighestPriyority();
         printf("task with Highest Priyority: %d\n", top.taskID);
     }
     return 0;
 }
     }
 }
 }