   var value: Int
   var R: Candy?
   var L: Candy?
+  var parent: Candy?
   var count: Int
 
-  init(_ v: Int) {
+  init(_ v: Int, _ p: Candy? = nil) {
     self.value = v
     self.count = 1
+    self.parent = p
   }
   func insert(n: Int) {
     if n < self.value {
       if let l = self.L {
         l.insert(n)
       } else {
-        self.L = Candy(n)
+        self.L = Candy(n, self)
       }
     } else if n == self.value {
       self.count += 1

      if let r = self.R {
        r.insert(n)
      } else {
        self.R = Candy(n)
      }
    }
  }

        return l.contains(n)
      }
    } else if n == self.value {
      return self.count > 0
    } else {
      if let r = self.R {
        return r.contains(n)
