public static void Main()
public ListNode(int x) {this.val = x; this.next = null;}
public static ListNode head;
public static void Solve(){
int t = Convert.ToInt32(Console.ReadLine());
String[] A = Console.ReadLine().Split(' ');
insert_node(Convert.ToInt32(A[1]),Convert.ToInt32(A[2]));
delete_node(Convert.ToInt32(A[1]));
public static void insert_node(int position, int value) {
ListNode newNode = new ListNode(value);
if(head == null && position ==1 ){
head = new ListNode(value);
if(head!=null && position==1){
ListNode IndexNode = head, prev=null;
while(IndexNode!=null && i<position){
IndexNode = IndexNode.next;
public static void delete_node(int position) {
ListNode TargetNode= head, prev = null;
if(TargetNode!=null && position==1){
while(TargetNode!=null && i<position){
TargetNode = TargetNode.next;
prev.next = TargetNode.next;
public static void print_ll() {
Console.Write(Environment.NewLine);