class Circular{ 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(n)){ return; } t = new Node(); t.data = x; t.next = t; if(index == 0){ if(first == null){ first = t; first.next = first; } else{ while(n.next!=first){ n = n.next; } n.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; } x = first.data; if(p==first){ first = null; } else{ p.next = first.next; first = p.next; } } else{ for(int i=0;i