You still don't explain where, e.g. |7|1|1553, comes from - I can't see those values in the input files. You refer to them as 'objects', but I have no idea what that means in this context...
Can you please explain how you derive these values - I might then be tempted to offer some help (although I will not write you a complete solution).
You would do a lot better if you at least posted some sort of attempt at coding this.
Tom Melly, email@example.com