from typing import Dict


def merge_freqs(tfs1: Dict[str, int], tfs2: Dict[str, int]) -> Dict[str, int]:
    """
    Merges term-frequencies from tfs1 and tfs2 dictionaries.
    This is an inplace operation i.e. It updates the largest dictionary in the argument inplace
    and returns that as result.
    """
    # keep the largest, dump the smallest;
    keep, dump = tfs1, tfs2
    if len(keep) < len(dump):
        keep, dump = dump, keep
    for k, v in dump.items():
        keep[k] = keep.get(k, 0) + v
    return keep