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

  var value: Int
  var R: Candy?
  var L: Candy?
  var count: Int

  init(_ v: Int) {
    self.value = v
    self.count = 1
  }
  func insert(n: Int) {
    if n < self.value {
      if let l = self.L {
        l.insert(n)
      } else {
        self.L = Candy(n)
      }
    } else if n == self.value {
      self.count += 1

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