#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<limits.h>
#define MOD 1000000007

int *array;

int min(int a, int b) {
    return a<b?a:b;
}

int max(int a, int b) {
    return a>b?a:b;
}

int compare(const void* a, const void* b) {
    return *(int*)a-*(int*)b;
}

int cmp(const void *a, const void *b){
    int ia = *(int *)a;
    int ib = *(int *)b;
    return array[ia] < array[ib] ? -1 : array[ia] > array[ib];
}

int abs(int n) {
    if(n < 0)
        return n*(-1);
    return n;
}

void swap(int *a, int *b) {
    *a = (*a)^(*b);
    *b = (*a)^(*b);
    *a = (*a)^(*b);
}

int binSearch(int a[], int x, int l, int r) {
    if(r >= l) {
        int mid = l + ((r-l)>>1);
        if(a[mid] == x)
            return mid;
        if(a[mid] > x) {
            return binSearch(a, x, l, mid-1);
        }
        else if(a[mid] < x) {
            return binSearch(a, x, mid+1, r);
        }
    }
    return -1;
}

int isRound(int n) {
    int count=0, count_0=0;
    while(n) {
        int x = n%10;
        
        // printf("%d\n", n%10);
        if(x == 0)
            count_0++;
        else
            count++;
        n /= 10;
    }
    if(count == 1)
        return 1;
    return 0;
}

int findRound(int n) {
    int count=0;
    int temp = n;
    while(temp) {
        count++;        
        temp /= 10;
    }
    int power=1;
    for(int i=0;i<count-1;i++)
        power *= 10;
    int res = n - (n%power);
    return res;
}

void testCase() {
    int i;
    char s[14], t[15];
    if(scanf("%s%s", s, t)) {
        for(i=0;s[i];i++) {
            if(s[i] != t[i]) {
                printf("No");
                return;
            }
        }
        printf("Yes");
    }
    
}

int main() {
    int t=1;
    scanf("%d", &t);
    while(t--) {
        testCase();
        printf("\n");
    }
    return 0;
}