import java.util.Map;
import java.util.HashMap;;


public class MyOneToOneMap<K,V> implements OneToOneMap<K,V>{

  private Map<K,V> mapKey;
  private Map<V,K> mapValue;
  
  
  public MyOneToOneMap(){
    mapKey = new HashMap<K,V>();
    mapValue = new HashMap<V,K>();
  }
  
  public void bind(K key, V value) {
    if ((mapKey.containsKey(key)) && (mapValue.containsKey(value))){
      return;
    } else {
    if (mapKey.containsKey(key)) {
      mapKey.put(key, value);
      mapValue.put(value, key);
    } else {
    if (mapValue.containsKey(value)) {
      mapKey.put(key, value);
      mapValue.put(value, key);
    }
    return;
    }
    }
  }

  public void removeKey(K key) {
       V value = mapKey.remove(key);
       mapValue.remove(value);
    
  }

  public void removeValue(V value) {
       K key = mapValue.remove(value);
       mapKey.remove(key);
  }
  
  public V getValue(K key){
    return mapKey.get(key);
  }

  public K getKey(V value){
    return mapValue.get(value);
  }
}

