using System;
public class Stack
{
Private Node GetNode(int index){
Node temp = first;
while(index >0){
temp = temp.Next;
index--;
}
return temp;
}
public object this[int index]{
get{
if(!ValidIndex(index))
   throw new Exception("");
   else 
   return GetNode(index).Value;
}
set{
if(!ValidIndex(index))
   throw new Exception("");
   else 
   GetNode(index).Value = value;
}
}
}class Test
{
  static void Main()
  {
   Stack s = new Stack();
   s.Push(1);
   s.Push(2);
   s.Push(3);
   s[0] = 33;
   s[1] = 22;
   s[2] = 11; 
   }}