#!/usr/bin/python3
import apt

def main():
    cache = apt.Cache()
    for pkg in cache:
        cand = pkg.candidate
        if not cand: continue
        tags = cand.record.get("Tag", None)
        if not tags: continue
        print(pkg.name, tags)

if __name__ == "__main__":
    main()
