Workers often have unobserved characteristics, e.g., soft skills, that are important for teamwork. In this paper, we formulate and estimate a model of teamwork that imposes no functional form restrictions on the complementarity between different unobserved types of workers. Our modeling approach, which builds on stochastic block models in statistics (e.g., Bickel et al., 2013) and the econometric framework developed by Bonhomme (2021), can quantify individual contributions when only teams' outputs are observed. We apply our model to data from a leading Chinese real estate company; the data contain the complete history of team assignments, team performances, and detailed property characteristics. We find that complementarity between different team members is heterogeneous, which is hard to capture with commonly used production function forms. Workers whose solo performance is at the intermediate level complement all other types of workers the most. The best solo-performing workers, however, are not the best team players. Our findings suggest that firms can improve productivity by redesigning teams without incurring additional hiring costs. We use counterfactual experiments to restructure teams based on the uncovered type complementarity and find that overall team output improves by as high as 28.4%.