#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = "Mathieu Lecarme <mathieu@garambrogne.net>"

import sys
import json

from ip2something import Index

idx = Index()

for ip in sys.stdin:
	print json.dumps(idx.search(ip))
