class Cir{ Node first,last,t; static class Node{ int data; Node next; } void create(int a[], int n){ first = new Node(); first.data =a[0]; first.next = first; last = first; for(int i=1;iLength(p)) return; t = new Node(); t.data = x; t.next = t; if(index==0){ if(first==null){ first = t; first.next = first; } else{ while(p.next!=first){ p.next = t; t.next = first; first = t; } } } else{ for(int i=0;iLength(p)){ return; } if(index==1){ while(p.next!=first){ p = p.next; } if(first==p){ first = null; } else{ p.next = first.next; first = p.next; }} else{ for(int i=0;i