**1. Introduction**

Every year, four billion tons of livestock feces are produced in Europe [1]. Its decomposition is an essential function of ecosystems, and dung beetles (Scarabaeidae: Scarabaeinae, Aphodiinae; Geotrupidae), which are widespread across most terrestrial habitats, play an important role in it [2,3]. Therefore, the conservation of dung beetles and the sustenance of the ecosystem service they provide is an important task. Dung beetles are involved in the decomposition of feces, not only by means of consumption by both larvae and imagoes [4] but even more importantly by chopping, spreading, and burying it, thereby making it available for other decomposing organisms [5,6]. By accelerating decomposition, they contribute to

the soil's nutrient cycle and stimulate plant growth by fertilization (increasing the nutrient content of the soil) [7]. Their vertical tunnels promote the mixing of soil layers, increase aeration, and permeability [8].

They also have an important role in maintaining human and animal health by removing the feces of domestic animals from the surface, thus controlling the number of parasitic worms and dung flies [9]. In addition, they assist the secondary distribution of plant seeds present in dung [10]. All of these activities are considered as valuable ecosystem services [3], resulting in significant financial savings for agriculture [11,12].

Only sufficiently diverse assemblages and abundant populations of dung beetles are able to perform their ecological function (acknowledging that body size and functional groups are also important factors [13,14]), but they are declining worldwide. The most serious adverse effects are land use changes, habitat fragmentation [15,16], and declining wild mammal species that provide feces [17,18], all of which transform and intensify traditional animal husbandry [19]. Overgrazing or abandoning pastures leads to a decrease in both abundance and species diversity [20–22]. The negative effects of agricultural intensification, and increased use of pesticides and insecticides, have already been demonstrated on a number of arthropod taxa [23], including dung beetles [24]. Numerous studies have shown that veterinary medical products, widely used in animal health today, and their breakdown products can cause drastic reductions in dung beetle populations as they appear in pastures through feces [14,25,26].

Dung beetles' lifestyles and ecological needs make them sensitive to environmental changes and they are therefore an important indicator group used in more and more studies that assess the state of the environment worldwide [27]. Farming and nature conservation practices that sustain species-rich communities able to perform their ecological functions are essential to the successful conservation of dung beetles. There are, however, still significant knowledge gaps. For example, both grassland and forest dung beetles are well-studied globally, which is important as dung beetle assemblages of forests and grasslands. These habitats are different, e.g., in terms of total biomass, species and functional compositions, and their functions in dung removal [15]. Buse and Entling [28] also found that dung removal is significantly different between forests and grasslands. These are in line with the evidence that dung beetles are highly sensitive to habitat modifications [16] and habitat structure at the local and landscape scales [29,30]. There is, however, a unique European habitat, the wood pasture, a transition between forest and grassland, where trees are scattered across pastures [31]. Wood pastures are still present in the Mediterranean and in Eastern Europe as part of farming systems [32], and present a socio-ecological framework for sustainable agriculture with high biodiversity. Such a unique habitat may provide novel information on how dung beetle assemblages form.

In Europe, including Hungary, the biggest threat to dung beetles is the decline of traditional farming systems. It has changed in many ways since the middle of the 20th century [33,34]. Grazing livestock has been significantly reduced, leaving many former pastures abandoned, while extensive animal husbandry was mostly replaced by intensive livestock farming. Although wood pastures and forest grazing were also well-established as important traditional practices in the last century [35], today only open grasslands are grazed. Nowadays, only a few wood pastures are used actively, but more and more are being restored and grazed mainly for nature conservation purposes. Forest grazing in Hungary has gradually declined and was finally completely ceased in the 1960s [35]. All these trends changed the resources for dung beetles, making them a threatened, declining group.

The objective of our study was to determine the effects of habitat type, dung type, and season on species richness, abundance, diversity, and species composition of dung beetle assemblages. Our aims were as follows:

First, we wanted to find out where (i.e., in what habitat) do dung beetles occur? Our study compared three habitat types with different levels of woodland cover: open pastures, wood pastures, and forests. Wood pastures are acknowledged as valuable habitats for several other taxa [36,37], and we were interested

in whether (i) they exhibit an outstanding diversity that harbors both forest and grassland species and thereby have their own specific species pool or if (ii) they represent a transitional situation for dung beetles.

Second, we were interested in what other factors influence dung beetle assemblages. A locality e ffect, for example, would sugges<sup>t</sup> that the generalization of any results and their applicability at other locations are limited. In addition, to analyse the e ffect of location, we also studied the e ffect of dung type and season, both of which are known to influence dung beetles [17,30] and thus may provide additional information to understand the distribution of dung beetles across habitat types. In our study, we compared the dung beetle assemblages in the feces of the three most important grazing livestock in Europe: cattle, horse, and sheep taken in di fferent seasons (spring, summer, and autumn).

Third, we intended to provide research evidence to guide nature conservation managemen<sup>t</sup> of wood pastures for the preservation of dung beetle assemblages and this unique habitat. Although some such results were known already from other regions or continents, management, which is context dependent, including locality, cannot directly use those results.

#### **2. Materials and Methods**

#### *2.1. Study Area*

Our study was conducted in three predominantly forested landscapes in the Northern and Transdanubian Mountains of Hungary (sampling locations are given as KMZ (Keyhole Markup language Zipped) files for Google Earth in the Supplementary Materials). The selected pastures and wood pastures were actively grazed. In the forests, there was no livestock grazing; however, wild ungulates such as red deer, roe deer, and wild boar were common. The sites were selected to meet two main criteria. First, they were to include patches of actually grazed wood pastures, as it is the rarest habitat type. Second, there had to be both actively used pastures and seminatural forests in the vicinity (within 2.5 km).
