class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

j = A("j")
h = B("h")
l = A("l")
a = A("a")
f = A("f")
i = B("i")
c = A("c")

j.v = i
j.x = h
h.t = f
l.v = i
l.x = h
a.v = i
a.x = h
f.v = h
f.x = i
i.t = c
c.v = h
c.x = i
assert f.x.t.v.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

j = A("j")
h = B("h")
l = A("l")
a = A("a")
f = A("f")
i = B("i")
c = A("c")

j.v = i
j.x = h
h.t = f
l.v = i
l.x = h
a.v = i
a.x = h
f.v = h
f.x = i
i.t = c
c.v = h
c.x = i
assert f.x.t.v.t.x.txt == "i"