#include<stdlib.h>
#include<stdio.h>
typedef struct node{
int id;
int fileSize;
int origSize;
struct node *parent;
struct node *child;
struct node *next;
struct node *brother;

}node;
#define SIZE 10003
int flag = 1;
node HashPool[SIZE + 3];
node HashTable[SIZE + 3];
int HashDex = 0;
node *getNewNode()
{
return &HashPool[HashDex++];
}
void insertNewNode(int key, node *newNode)
{
newNode->next = HashTable[key].next;
HashTable[key].next = newNode;
}
void init()
{


}
int issame(int a,int b)
{
if (a == b) return 1;
return 0;
}
node *searchNode(int key,int pid)
{
node *head = HashTable[key].next;
while (head)
{
if (issame(head->id, pid))
return head;
head = head->next;
}
return NULL;

}
int add(int id, int pid, int fileSize)
{
//scanf("%d%d%d", &id, &pid, &fileSize);
int val = id%SIZE;
node *newNode = getNewNode();
newNode->id = id;
newNode->origSize = fileSize;
insertNewNode(val, newNode);
int pval = pid%SIZE;
node *temp=searchNode(pval, pid);
temp->child = newNode;
newNode->parent = temp;
newNode->brother = temp->child;
}
node *isfirst(int val,int id){
node *head = HashTable[val].next;
while (head)
{
if (issame(head->id, id))
{
if (head->parent->child == head)
{
flag = 1;
return head;
}
}
}
}
int move(int id, int pid){
//scanf("%d%d", &id, &pid);
int val = id%SIZE;
int pval = pid%SIZE;
node *temp = isfirst(pval,id);
if (flag == 1)
{
temp->child = temp->child->brother;
}
else{

}

 

return 0;
}
int infect(int id){
scanf("%d", &id);
}
int recover(int id){
scanf("%d", &id);
}
int remove(int id){
scanf("%d", &id);
}