FARGO, N.D. (AP) - A class of sixth-graders from North Dakota has schooled some of the best college business students in the country on the stock market.

It started as a competition between the regular and advanced math classes at Fargo's Oak Grove Lutheran School, where Dave Carlson was teaching his students about handling money through two online investment companies. Unbeknownst to the middle school investors, one of the companies was at that time holding a university challenge that offered a $5,000 first prize to the investment club with the most profitable basket of stocks.

While Virginia-based McIntire Investment Institute won that contest with an 18.5 percent return, Carlson's regular math class yielded a nearly 22 percent gain and trounced all the university clubs on a return-since-creation basis.

"When we found out we had beat the colleges, everybody was really loud and yelling," said Jacob Lang, one of 13 students in the Oak Grove class. "It was really cool."

Carlson's classes started the project using an app through BreadVault, a Fargo company that makes online money management tools designed for families with children. BreadVault owner Ross Almlie referred them to Motif Investing, a San Mateo, Calif.-based company that enables customers to buy baskets of stocks that are named motifs.

The class results so impressed Motif Investing founder Hardeep Walia that he made his first trip to North Dakota this month to visit the students.

"You guys crushed it," he told the young investors who mopped up with stocks like Netflix, Starbucks, Under Armour, Facebook, Amazon, Google and Priceline.com.

Motif charges a flat fee of $9.95 to buy collections of up to 30 stocks based on an investment idea. Walia's wife, for instance, has a motif called "No Glass Ceilings," which is based on stocks of companies led by female executives. Other examples, apropos to North Dakota, are "Rising Food Prices," featuring products from the farm to the supermarket, and "Frack Attack," focusing on the oil and gas industry.

If someone else buys a customer's motif, the customer makes a royalty. Walia himself snatched up the Oak Grove motif.

"It made me a lot of money," he told the class.

The motif assembled by Carlson's Math Minions centered on companies the students knew about with good track records. They did research and in most cases made solid investment decisions. Eloise Baker said she decided to buy Under Armour, which makes sportswear and athletic gear, based mainly on the fact that Christmas and the Olympics were around the corner. Sure enough, the stock shot up. The company just last week approved a 2-for-1 split.

"That's what I wanted for Christmas. I thought that's what a lot of other kids wanted," she said of Under Armour clothing. "I also found it to be a little bit cheaper than Nike, so I thought it was a good buy."

While each student was allowed to make one stock switch, Carlson encouraged them to be patient with their selections. He believed the class came out ahead of the university challenge in part because the college students were looking for a quick buck.

"I thought the best idea was to pick a stock that you believe in, a company that you liked, a company that you were interested in, and stay with them," Carlson said.

Walia said he was "blown away" with the level of thinking by the Oak Grove investors. Not all of the students were taking credit, however. Ben Swenson, who invested in Stratus Properties Inc., had another explanation for the high returns.