JPMorganChase Interview Question

- Asked to Print Grid connections(Similar to Rotten Oranges)