#include <cstdio>

struct list { 
	igra vr;
	list* sl; 
};

typedef list* element;
typedef list lista; 

element FirstL(lista *L) {
	return L; 
}

element EndL(lista* L){ 
        while (L->sl!=NULL) 
              L = L->sl; 
        return L; 
}

element NextL(element elem, lista *L){ 
	return elem->sl;
}

element PreviousL(element elem, lista *L){ 
	while (L->sl!=elem)
		L = L->sl;
	return L;
}

element LocateL(igra M, lista *L){ 
	while (L->sl->vr.zanr!=M.zanr)
		L = L->sl;
	return L;
}

bool InsertL(igra M, element elem, lista *L){ 
	element privp = new lista; 
    privp->vr = M; 
    privp->sl = elem->sl; 
    elem->sl = privp; 
    return true; 
}

void DeleteL(element elem, lista *L){
	element obris = elem->sl;
	elem->sl = obris->sl;
	delete obris; 
}

igra RetrieveL(element elem, lista *L){ 
		return elem->sl->vr;
}

void DeleteAllL(lista *L){ 
	element obris = L->sl;
	while (obris!=NULL) {
		L->sl = obris->sl;
		delete obris;
		obris = L->sl;
	}
}

void InitL(lista* L){
     L->sl = NULL; 
}