#include <stdio.h>
#include <stdlib.h>
int main() {
    int n, cost[10][10];

    printf("Enter the number of nodes: ");
    scanf("%d", &n);

    printf("Enter the cost adjacency matrix (use 0 for no connection):\n");
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            scanf("%d", &cost[i][j]);
            if (cost[i][j] == 0 && i != j) {
                cost[i][j] = INF; // Replace 0 with INF for non-diagonal elements
            }
        }
    }

    prims(n, cost);

    return 0;
}