in first method your format is incorrect
should be
str Av=
"1 hello
1 world"
str B="2 key"
str Bv=
"2 hello
2 world"
str C="3 key"
str Cv=
"3 hello
3 world"
second method will work as well
should be
str Av=
"1 hello
1 world"
str B="2 key"
str Bv=
"2 hello
2 world"
str C="3 key"
str Cv=
"3 hello
3 world"
second method will work as well