using System;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Globalization;
using System.Collections.Generic;
using System.Threading;
using kp.Algo;

namespace CodeForces
{
	internal class Solution
	{
		const int StackSize = 20 * 1024 * 1024;

		private void Solve()
		{
			long n = NextLong(), m = NextLong(), x = NextLong(), y = NextLong(), a = NextLong(), b = NextLong();
			long g = NumTheoryUtils.Gcd( a, b );
			a /= g;
			b /= g;
			long k = Math.Min( n / a, m / b );
			long xl = k * a, yl = k * b;
			long x1 = ( xl % 2 == 0 ? x - xl / 2 : x - xl / 2 - 1 );
			long y1 = ( yl % 2 == 0 ? y - yl / 2 : y - yl / 2 - 1 );
			if ( x1 < 0 ) x1 = 0;
			if ( y1 < 0 ) y1 = 0;
			if ( x1 + xl > n ) x1 -= ( x1 + xl ) - n;
			if ( y1 + yl > m ) y1 -= ( y1 + yl ) - m;
			Out.WriteLine( string.Format( "{0} {1} {2} {3}", x1, y1, x1 + xl, y1 + yl ) );
		}

		#region Local wireup

		public int NextInt()
		{
			return _in.NextInt();
		}

		public long NextLong()
		{
			return _in.NextLong();
		}

		public string NextLine()
		{
			return _in.NextLine();
		}

		public double NextDouble()
		{
			return _in.NextDouble();
		}

		readonly Scanner _in = new Scanner();
		static readonly TextWriter Out = Console.Out;

		void Start()
		{
#if !ONLINE_JUDGE
			var timer = new Stopwatch();
			timer.Start();
#endif
			var t = new Thread( Solve, StackSize );
			t.Start();
			t.Join();
#if !ONLINE_JUDGE
			timer.Stop();
			Console.WriteLine( string.Format( CultureInfo.InvariantCulture, "Done in {0} seconds.\nPress <Enter> to exit.", timer.ElapsedMilliseconds / 1000.0 ) );
			Console.ReadLine();
#endif
		}

		static void Main()
		{
			new Solution().Start();
		}

		class Scanner : IDisposable
		{
			#region Fields

			readonly TextReader _reader;
			readonly int _bufferSize;
			readonly bool _closeReader;
			readonly char[] _buffer;
			int _length, _pos;

			#endregion

			#region .ctors

			public Scanner( TextReader reader, int bufferSize, bool closeReader )
			{
				_reader = reader;
				_bufferSize = bufferSize;
				_closeReader = closeReader;
				_buffer = new char[_bufferSize];
				FillBuffer( false );
			}

			public Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }

			public Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }

#if ONLINE_JUDGE
			public Scanner() : this( Console.In, false ) { }
#else
			public Scanner() : this( "input.txt" ) { }
#endif

			#endregion

			#region IDisposable Members

			public void Dispose()
			{
				if ( _closeReader )
				{
					_reader.Close();
				}
			}

			#endregion

			#region Properties

			public bool Eof
			{
				get
				{
					if ( _pos < _length ) return false;
					FillBuffer( false );
					return _pos >= _length;
				}
			}

			#endregion

			#region Methods

			private char NextChar()
			{
				if ( _pos < _length ) return _buffer[_pos++];
				FillBuffer( true );
				return _buffer[_pos++];
			}

			private char PeekNextChar()
			{
				if ( _pos < _length ) return _buffer[_pos];
				FillBuffer( true );
				return _buffer[_pos];
			}

			private void FillBuffer( bool throwOnEof )
			{
				_length = _reader.Read( _buffer, 0, _bufferSize );
				if ( throwOnEof && Eof )
				{
					throw new IOException( "Can't read beyond the end of file" );
				}
				_pos = 0;
			}

			public int NextInt()
			{
				var neg = false;
				int res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public long NextLong()
			{
				var neg = false;
				long res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public string NextLine()
			{
				SkipUntilNextLine();
				if ( Eof ) return "";
				var builder = new StringBuilder();
				while ( !Eof && !IsEndOfLine( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return builder.ToString();
			}

			public double NextDouble()
			{
				SkipWhitespaces();
				var builder = new StringBuilder();
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return double.Parse( builder.ToString(), CultureInfo.InvariantCulture );
			}

			private void SkipWhitespaces()
			{
				while ( !Eof && IsWhitespace( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private void SkipUntilNextLine()
			{
				while ( !Eof && IsEndOfLine( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private static bool IsWhitespace( char c )
			{
				return c == ' ' || c == '\t' || c == '\n' || c == '\r';
			}

			private static bool IsEndOfLine( char c )
			{
				return c == '\n' || c == '\r';
			}

			#endregion
		}

		#endregion
	}
}

namespace kp.Algo { }

namespace kp.Algo
{
	static class NumTheoryUtils
	{
		public static long Gcd( long a, long b )
		{
			if ( a < 0 ) a = -a;
			if ( b < 0 ) b = -b;
			return b == 0 ? a : Gcd( b, a % b );
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class R183_Div2_D
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int x = int.Parse(s[2]);
            int y = int.Parse(s[3]);
            int a = int.Parse(s[4]);
            int b = int.Parse(s[5]);
            int g = GCD_Euclid(a, b);
            a = a / g;
            b = b / g;

            int xDif = Math.Min(n - x, x - 0);
            int yDif = Math.Min(m - y, y - 0);

            int t = Math.Min(n / a, m / b);
            a *= t;
            b *= t;

            int x1, y1, x2, y2;
            x1 = x - a + (a / 2);
            y1 = y - b + (b / 2);
            x1 = Math.Min(x1, n - a);
            y1 = Math.Min(y1, m - b);
            x1 = Math.Max(x1, 0);
            y1 = Math.Max(y1, 0);
            x2 = x1 + a;
            y2 = y1 + b;
            Console.WriteLine(x1 + " " + y1 + " " + x2 + " " + y2);
        }

        static int GCD_Euclid(int a, int b)
        {
            if (b == 0) return a;
            return GCD_Euclid(b, a % b);
        }
    }
}

using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;

namespace Codeforces.R303
{
    public static class B
    {
        public static void Main()
        {
            using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Solve(Console.In, sw);
            }
        }

        public static void Solve(TextReader tr, TextWriter tw)
        {
            Contract.Requires(tr != null);
            Contract.Requires(tw != null);

            tw.WriteLine(Parse(tr));
        }

        private static string Parse(TextReader tr)
        {
            var info = CultureInfo.CurrentCulture;
            var l = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();

            return Calc(l[0], l[1], l[2], l[3], l[4], l[5]);
        }

        public static string Calc(int n, int m, int x, int y, int a, int b)
        {
            Reduce(ref a, ref b);
            var maxFactor = Math.Min(n / a, m / b);
            var w = a * maxFactor;
            var h = b * maxFactor;

            var x1 = Nearest(n, w, x);
            var y1 = Nearest(m, h, y);

            var x2 = x1 + w;
            var y2 = y1 + h;

            return $"{x1} {y1} {x2} {y2}";
        }

        public static int Nearest(int n, int w, int x)
        {
            return Math.Max(0, Math.Min(x - (w + 1) / 2, n - w));
        }

        public static void Reduce(ref int a, ref int b)
        {
            var gcd = Gcd(a, b);
            a /= gcd;
            b /= gcd;
        }

        public static int Gcd(int a, int b)
        {
            while (a != 0)
            {
                var r = b % a;
                b = a;
                a = r;
            }
            return b;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class Prob303B
    {
        //Your task is to find a maximum sub-rectangle on the grid (x1, y1, x2, y2) so that it contains the given point (x, y),
        //and its length-width ratio is exactly (a, b). In other words the following conditions must hold:
        //0 ≤ x1 ≤ x ≤ x2 ≤ n, 0 ≤ y1 ≤ y ≤ y2 ≤ m, (x2-x1)/(y2-y1)=a/b.

        //The sides of this sub-rectangle should be parallel to the axes. And values x1, y1, x2, y2 should be integers.

        //If there are multiple solutions, find the rectangle which is closest to (x, y). Here "closest" means the Euclid
        //distance between (x, y) and the center of the rectangle is as small as possible. If there are still multiple
        //solutions, find the lexicographically minimum one. Here "lexicographically minimum" means that we should consider
        //the sub-rectangle as sequence of integers (x1, y1, x2, y2), so we can choose the lexicographically minimum one.
        class Pair
        {
            int x;
            int y;

            public Pair()
            {
                x = 0;
                y = 0;
            }

            public Pair(int xx, int yy)
            {
                x = xx;
                y = yy;
            }

            public int X
            {
                get { return x; }
                set { x = value; }
            }

            public int Y
            {
                get { return y; }
                set { y = value; }
            }

            public Pair shift(Pair shiftBy)
            {
                return new Pair(x + shiftBy.X, y + shiftBy.Y);
            }

            public Pair simplify()
            {
                int a = x;
                int b = y;
                int rem;

                while (b != 0)
                {
                    rem = a % b;
                    a = b;
                    b = rem;
                }
                return new Pair(x / a, y / a);
            }

            public override String ToString()
            {
                return x + " " + y;
            }
        }

        class Rectangle
        {
            Pair bottomLeft;
            Pair upperRight;
            int width;
            int height;

            public Rectangle()
            {
                bottomLeft = new Pair();
                upperRight = new Pair();
                width = 0;
                height = 0;
            }

            public Rectangle(Pair bl, Pair ur)
            {
                bottomLeft = bl;
                upperRight = ur;
                width = upperRight.X - bottomLeft.X;
                height = upperRight.Y - bottomLeft.Y;
            }

            public Pair getLargestFit(Pair ratio)
            {
                int max = Math.Min(width / ratio.X, height / ratio.Y);
                return new Pair(ratio.X * max, ratio.Y * max);
            }

            public Rectangle getClosestRectangle(Pair point, Pair dims)
            {
                Pair bottomLeftCorner = new Pair();

                bottomLeftCorner.X = point.X - (dims.X / 2) - (dims.X & 1);
                if (bottomLeftCorner.X < 0)
                {
                    bottomLeftCorner.X = 0;
                }
                else if (bottomLeftCorner.X + dims.X > width)
                {
                    bottomLeftCorner.X = width - dims.X;
                }

                bottomLeftCorner.Y = point.Y - (dims.Y / 2) - (dims.Y & 1);
                if (bottomLeftCorner.Y < 0)
                {
                    bottomLeftCorner.Y = 0;
                }
                else if (bottomLeftCorner.Y + dims.Y > height)
                {
                    bottomLeftCorner.Y = height - dims.Y;
                }

                return new Rectangle(bottomLeftCorner, bottomLeftCorner.shift(dims));
            }

            public override String ToString()
            {
                return bottomLeft.ToString() + " " + upperRight.ToString();
            }
        }

        Rectangle housing;
        Pair point;
        Pair ratio;

        public Prob303B(int n, int m, int x, int y, int a, int b)
        {
            housing = new Rectangle(new Pair(0, 0), new Pair(n, m));
            point = new Pair(x, y);
            ratio = new Pair(a, b);
        }

        public String solve()
        {
            Pair rectDims = housing.getLargestFit(ratio.simplify());
            Rectangle result = housing.getClosestRectangle(point, rectDims);
            return result.ToString();
        }

        public override String ToString()
        {
            return housing.ToString() + " " + point.ToString() + " " + ratio.ToString();
        }

        static void Main(string[] args)
        {
            String line = Console.ReadLine();
            String[] temp = line.Split(' ');
            int[] vals = new int[temp.Length];
            for (int i = 0; i < vals.Length; ++i)
            {
                vals[i] = Convert.ToInt32(temp[i]);
            }
            Prob303B prob = new Prob303B(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5]);
            Console.WriteLine(prob.solve());
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Codeforces
{
    class Program {

        #region input

        static long readLong() {
            long num;
            long.TryParse(Console.ReadLine(),out num);
            return num;
        }

        static ulong readULong() {
            ulong num;
            ulong.TryParse(Console.ReadLine(),out num);
            return num;
        }

        static int readInt() {
            int num;
            int.TryParse(Console.ReadLine(),out num);
            return num;
        }

        static bool readBool() {
            int num;
            int.TryParse(Console.ReadLine(),out num);
            return num != 0;
        }

        static long[] readLongs() {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            long[] parsed = new long[nums.Length];
            for(int i = 0; i < nums.Length; i++) {
                long.TryParse(nums[i],out parsed[i]);
            }
            return parsed;
        }

        static int[] readInts() {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            int[] parsed = new int[nums.Length];
            for(int i = 0; i < nums.Length; i++) {
                int.TryParse(nums[i],out parsed[i]);
            }
            return parsed;
        }

        static void readInts(out int a, out  int b) {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            int[] parsed = new int[nums.Length];
            int.TryParse(nums[0],out a);
            int.TryParse(nums[1],out b);
        }

        static BitArray readBools() {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            BitArray bits = new BitArray(nums.Length);
            for(int i = 0; i < nums.Length; i++) {
                if(nums[i] != "0") {
                    bits[i] = true;
                }
            }
            return bits;
        }

        static BitArray readBools(string off) {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            BitArray bits = new BitArray(nums.Length);
            for(int i = 0; i < nums.Length; i++) {
                if(nums[i] != off) {
                    bits[i] = true;
                }
            }
            return bits;
        }

        static void waist() {
            Console.ReadLine();
        }

        #endregion

        #region utility

        static long largeModolu(long a,long b,long m) {
            long prev = a;
            long sum = (b & 1) > 0 ? a : 1;
            int digits = (int)(Math.Ceiling(Math.Log(b,2)));
            for(int i = 1; i < digits; i++) {
                prev = (prev * prev) % (m);
                if((b & (1l << i)) > 0) {
                    sum = (sum * prev) % (m);
                }
            }
            return sum;
        }

        static long GCD(long a, long b) {
            long temp;
            if(a > b) {
                temp = b;
                b = a;
                a = temp;
            }
            while(b != 0) {
                temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }

        class SortableKVP<T> where T : IComparable {
            List<Tuple<int,T>> data { set; get; }

            public int count {
                get {
                    return data.Count;
                }
            }

            public T this[int index] {
                get {
                    return data[index].Item2;
                }
            }

            public int originalIndex(int sortedIndex) {
                return data[sortedIndex].Item1;
            }

            public void sort() {
                data.Sort((a,b) => a.Item2.CompareTo(b.Item2));
            }

            public void add(T item) {
                data.Add(new Tuple<int,T>(data.Count,item));
            }

            public void removeAt(int sortedIndex) {
                data.RemoveAt(sortedIndex);
            }

            public SortableKVP() {
                data = new List<Tuple<int,T>>();
            }

            public SortableKVP(T[] data) {
                this.data = new List<Tuple<int,T>>(data.Length);
                for(int i = 0; i < data.Length; i++) {
                    this.data.Add(new Tuple<int,T>(i,data[i]));
                }
            }
        }

        #endregion

        static void Main(string[] args) {
            long[] nmxyab = readLongs();
            long n = nmxyab[0];
            long m = nmxyab[1];
            long x = nmxyab[2];
            long y = nmxyab[3];
            long a = nmxyab[4];
            long b = nmxyab[5];
            long gcd = GCD(a,b);
            a /= gcd;
            b /= gcd;
            long multiplier = Math.Min(n / a,m / b);
            long xLength = a * multiplier;
            long yLength = b * multiplier;
            long x1 = Math.Min(n - xLength,Math.Max(0,x - (xLength + 1) / 2));
            long y1 = Math.Min(m - yLength,Math.Max(0,y - (yLength + 1) / 2));
            Console.WriteLine(x1 + " " + y1 + " " + (x1 + xLength) + " " + (y1 + yLength));
        }

        /*static void Main(string[] args) {
            BitArray primes = new BitArray(1000001,true);
            primes[0] = false;
            primes[1] = false;
            for(int i = 2; i * i <= 1000000; i++) {
                if(primes[i]) {
                    for(int j = i * 2; j <= 1000000; j += i) {
                        primes[j] = false;
                    }
                }
            }
            int t = readInt();
            for(int r = 0; r < t; r++) {
                int[] range = readInts();
                int sum = 0;
                for(int i = range[0]; i <= range[1]; i++) {
                    if(primes[i]) {
                        sum++;
                    }
                }
                Console.WriteLine(sum);
            }
            Console.Read();
        }*/

        /*static void Main(string[] args) {
            int t = readInt();
            for(int r = 0; r < t; r++) {
                waist();
                int[] nums = readInts();
                Array.Sort(nums, (a,b) => b.CompareTo(a));
                for(int i = 0; i < nums.Length; i++) {
                    if((i & 1) == 0 ) {
                        Console.Write(nums[i/2]);
                    } else {
                        Console.Write(nums[nums.Length - 1- (i-1)/2]);
                    }
                    if(i == nums.Length - 1) {
                        Console.WriteLine("");
                    } else {
                        Console.Write(" ");
                    }
                }
            }
            Console.Read();
        }*/
    }
}
//0.89493155168539774035319
//0.894931551685397740353194
//0.894931551685397735434921

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace D
{
    class Program
    {
        public static int gcd(int a, int b)
        {
            if (a < b)
            {
                return gcd(b, a);
            }
            else
            {
                if (b == 0)
                {
                    return a;
                }
                else
                {
                    return gcd(b, a % b);
                }
            }
        }
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 2; testN++)
            {
#endif
                //SetCulture();
                var n = NextInt();
                var m = NextInt();
                var x = NextInt();
                var y = NextInt();
                var a = NextInt();
                var b = NextInt();

                var g = gcd(a, b);
                a = a / g;
                b = b / g;
                var ma = n / a;
                var mb = m / b;
                var k = Math.Min(ma, mb);
                var mx = k * a;
                var my = k * b;

                var x1 = x - ((mx + 1) / 2);
                var y1 = y - ((my + 1) / 2);
                var x2 = x + (mx / 2);
                var y2 = y + (my / 2);
                if (x1 < 0)
                {
                    x2 += -x1;
                    x1 = 0;
                }
                if (x2 > n)
                {
                    x1 -= (x2 - n);
                    x2 = n;
                }
                if (y1 < 0)
                {
                    y2 += -y1;
                    y1 = 0;
                }
                if (y2 > m)
                {
                    y1 -= (y2 - m);
                    y2 = m;
                }

                Console.WriteLine("{0} {1} {2} {3}", x1, y1, x2, y2);
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

#define Online
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            long n, m, x, y, a, b;
            string[] input = ReadArray();
            n = long.Parse(input[0]);
            m = long.Parse(input[1]);
            x = long.Parse(input[2]);
            y = long.Parse(input[3]);
            a = long.Parse(input[4]);
            b = long.Parse(input[5]);

            long gcd = MyMath.GCD(a, b);
            a /= gcd;
            b /= gcd;

            long left = 1;
            long right = m;

            long mid;
            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (mid * a >= n || mid * b >= m)
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }
            if (!(left * a <= n && left * b <= m))
                left--;

            long w, h;
            w = left * a;
            h = left * b;
            long x1, y1, x2, y2;
            x1 = x2 = y1 = y2 = 0;

            if (x + w / 2 > n)
            {
                x1 = x - (w % 2L == 0 ? w / 2L : w / 2L + 1L) - (x + w / 2L - n);
                x2 = x1 + w;
            }
            else
            {
                if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) < 0)
                {
                    x1 = 0;
                    x2 = w;
                }
                else
                {
                    x1 = x - (w % 2L == 0 ? w / 2L : w / 2L + 1L);
                    x2 = x1 + w;
                }
            }
            if (y + h / 2 > m)
            {
                y1 = y - (h % 2L == 0 ? h / 2L : h / 2L + 1L) - (y + h / 2L - m);
                y2 = y1 + h;
            }
            else
            {
                if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) < 0)
                {
                    y1 = 0;
                    y2 = h;
                }
                else
                {
                    y1 = y - (h % 2L == 0 ? h / 2L : h / 2L + 1L);
                    y2 = y1 + h;
                }
            }

            Console.WriteLine(x1 + " " + y1 + " " + x2 + " " + y2);
#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
    }

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    public class SegmentTree
    {
        int[] v_min;
        int[] v_max;
        int[] mas;
        public void BuildTree(int[] a)
        {
            int n = a.Length - 1;
            int z = 0;
            while (n >= 2)
            {
                z++;
                n >>= 1;
            }
            n = 1 << (z + 1);
            v_min = new int[n << 1];
            v_max = new int[n << 1];
            mas = new int[n << 1];
            for (int i = n; i < n + a.Length; i++)
                v_min[i] = a[i - n];
            for (int i = n + a.Length; i < v_min.Length; i++)
                v_min[i] = int.MaxValue;
            for (int i = n - 1; i > 0; i--)
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);

            for (int i = n; i < n + a.Length; i++)
                v_max[i] = a[i - n];
            for (int i = n + a.Length; i < v_max.Length; i++)
                v_max[i] = int.MinValue;
            for (int i = n - 1; i > 0; i--)
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);

        }
        //nil
        public int RMQ_MIN(int l, int r)
        {
            int ans = int.MaxValue;
            l += v_min.Length >> 1;
            r += v_min.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Min(ans, v_min[l]);
                if (!((r & 1) == 0))
                    ans = Math.Min(ans, v_min[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public int RMQ_MAX(int l, int r)
        {
            int ans = int.MinValue;
            l += v_max.Length >> 1;
            r += v_max.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Max(ans, v_max[l]);
                if (!((r & 1) == 0))
                    ans = Math.Max(ans, v_max[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public void Put(int l, int r, int op)
        {
            l += mas.Length >> 1;
            r += mas.Length >> 1;
            while (l <= r)
            {
                if (l % 2 != 0)
                    mas[l] = op;
                if (r % 2 == 0)
                    mas[r] = op;
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
        }

        public int Get(int x)
        {
            x += mas.Length >> 1;
            int ans = int.MinValue;
            while (x > 0)
            {
                ans = Math.Max(mas[x], ans);
                x >>= 1;
            }
            return ans;
        }

        public void Update(int i, int x)
        {
            i += v_min.Length >> 1;
            v_min[i] = x;
            v_max[i] = x;
            i >>= 1;
            while (i > 0)
            {
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);
                i >>= 1;
            }
        }
    }
    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }
    class Graph
    {
        public List<List<int>> g = new List<List<int>>();
        public List<Edge> e = new List<Edge>();
        public Stack<int> s;
        public List<bool> u;
        public List<int> d; //длина
        public List<int> p; //путь
        public Queue<int> q;
        public int n;
        public int start;
        public int finish;
        public Graph(int n)
        {
            for (int i = 0; i <= n; i++)
                g.Add(new List<int>());
            p = new List<int>();
            d = new List<int>();
            for (int i = 0; i <= n; i++)
                p.Add(-1);
            for (int i = 0; i <= n; i++)
                d.Add(-1);
            u = new List<bool>();
            for (int i = 0; i <= n; i++)
                u.Add(true);
            this.n = n;
        }

        public bool dfs1(int v)
        {
            u[v] = false;
            for (int i = 0; i < g[v].Count; i++)
            {
                if (u[g[v][i]])
                {
                    p[g[v][i]] = v;
                    if (dfs1(g[v][i])) return true;
                }
                else
                {
                    if (p[v] != g[v][i])
                    {
                        start = v;
                        finish = g[v][i];
                        return true;
                    }
                }
            }
            return false;
        }

        public void dfs2(int v)
        {
            s = new Stack<int>();
            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (d[g[cur][i]] == -1)
                    {
                        s.Push(g[cur][i]);
                        d[g[cur][i]] = d[cur] + 1;
                        all = false;
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void DFS(int v)
        {
            s = new Stack<int>();

            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                u[cur] = false;
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (u[g[cur][i]])
                    {
                        all = false;
                        p[g[cur][i]] = cur;
                        s.Push(g[cur][i]);
                    }
                    else
                    {
                        if (p[cur] != g[cur][i])
                        {
                            start = cur;
                            finish = g[cur][i];
                            return;
                        }
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void BFS(params int[] v)
        {
            q = new Queue<int>();
            u = new List<bool>();
            d = new List<int>();
            p = new List<int>();

            for (int i = 0; i <= n; i++)
            {
                u.Add(true);
                d.Add(0);
                p.Add(0);
            }

            q.Enqueue(v[0]);
            u[v[0]] = false;
            int cur;

            while (q.Count != 0)
            {
                cur = q.Dequeue();
                for (int i = 0; i < g[cur].Count; i++)
                    if (u[g[cur][i]])
                    {
                        q.Enqueue(g[cur][i]);
                        u[g[cur][i]] = false;
                        p[g[cur][i]] = cur;
                        d[g[cur][i]] = d[cur] + 1;
                    }
            }

            int from = v[1];
            string path = from + "";
            while (p[from] != 0)
            {
                path = p[from] + " " + path;
                from = p[from];
            }
            Console.WriteLine(d[v[1]] + " : " + path);
        }

        public void FordBellman(params int[] v)
        {
            d = new List<int>();
            p = new List<int>();
            for (int i = 0; i <= n; i++)
            {
                d.Add(int.MaxValue);
                p.Add(0);
            }
            d[v[0]] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < e.Count; j++)
                {
                    if (d[e[j].a] != int.MaxValue)
                    {
                        if (d[e[j].a] + e[j].w < d[e[j].b])
                        {
                            d[e[j].b] = d[e[j].a] + e[j].w;
                            p[e[j].b] = e[j].a;
                        }
                    }
                }
            }

            int from = v[1];

            if (d[from] == int.MaxValue)
            {
                Console.WriteLine("Can't find the minimal path");
                return;
            }

            string ans = from + "";
            while (p[from] != 0)
            {
                ans = p[from] + " " + ans;
                from = p[from];
            }

            Console.WriteLine(d[v[1]] + " : " + ans);
        }
    }
    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class Prob303B
    {
        //Your task is to find a maximum sub-rectangle on the grid (x1, y1, x2, y2) so that it contains the given point (x, y),
        //and its length-width ratio is exactly (a, b). In other words the following conditions must hold:
        //0 ≤ x1 ≤ x ≤ x2 ≤ n, 0 ≤ y1 ≤ y ≤ y2 ≤ m, (x2-x1)/(y2-y1)=a/b.

        //The sides of this sub-rectangle should be parallel to the axes. And values x1, y1, x2, y2 should be integers.

        //If there are multiple solutions, find the rectangle which is closest to (x, y). Here "closest" means the Euclid
        //distance between (x, y) and the center of the rectangle is as small as possible. If there are still multiple
        //solutions, find the lexicographically minimum one. Here "lexicographically minimum" means that we should consider
        //the sub-rectangle as sequence of integers (x1, y1, x2, y2), so we can choose the lexicographically minimum one.
        class Pair
        {
            int x;
            int y;

            public Pair()
            {
                x = 0;
                y = 0;
            }

            public Pair(int xx, int yy)
            {
                x = xx;
                y = yy;
            }

            public int X
            {
                get { return x; }
                set { x = value; }
            }

            public int Y
            {
                get { return y; }
                set { y = value; }
            }

            public Pair makeBigger(int n)
            {
                return new Pair(x * n, y * n);
            }

            public Pair shift(Pair shiftBy)
            {
                return new Pair(x + shiftBy.X, y + shiftBy.Y);
            }

            public Pair simplify()
            {
                int a = x;
                int b = y;
                int rem;

                while (b != 0)
                {
                    rem = a % b;
                    a = b;
                    b = rem;
                }
                return new Pair(x / a, y / a);
            }

            public override String ToString()
            {
                return x + " " + y;
            }
        }

        class Rectangle
        {
            Pair bottomLeft;
            Pair upperRight;
            int width;
            int height;

            public Rectangle()
            {
                bottomLeft = new Pair();
                upperRight = new Pair();
                width = 0;
                height = 0;
            }

            public Rectangle(Pair bl, Pair ur)
            {
                bottomLeft = bl;
                upperRight = ur;
                width = upperRight.X - bottomLeft.X;
                height = upperRight.Y - bottomLeft.Y;
            }

            public Pair getLargestFit(Pair ratio)
            {
                Pair p = new Pair(ratio.X, ratio.Y);
                int max = Math.Min(width / p.X, height / p.Y);
                int min = 1;
                int mid;
                while (max > min)
                {
                    mid = min + (max - min) / 2;
                    if (p.X * mid > width || p.Y * mid > height)
                    {
                        max = mid - 1;
                    }
                    else if (mid == min)
                    {
                        min = max;
                    }
                    else
                    {
                        min = mid;
                    }
                }
                return p.makeBigger(min);
            }

            public Rectangle getClosestRectangle(Pair point, Pair dims)
            {
                Pair bottomLeftCorner = new Pair();

                bottomLeftCorner.X = point.X - (dims.X / 2) - (dims.X & 1);
                if (bottomLeftCorner.X < 0)
                {
                    bottomLeftCorner.X = 0;
                }
                else if (bottomLeftCorner.X + dims.X > width)
                {
                    bottomLeftCorner.X = width - dims.X;
                }

                bottomLeftCorner.Y = point.Y - (dims.Y / 2) - (dims.Y & 1);
                if (bottomLeftCorner.Y < 0)
                {
                    bottomLeftCorner.Y = 0;
                }
                else if (bottomLeftCorner.Y + dims.Y > height)
                {
                    bottomLeftCorner.Y = width - dims.Y;
                }

                return new Rectangle(bottomLeftCorner, bottomLeftCorner.shift(dims));
            }

            public override String ToString()
            {
                return bottomLeft.ToString() + " " + upperRight.ToString();
            }
        }

        Rectangle housing;
        Pair point;
        Pair ratio;

        public Prob303B(int n, int m, int x, int y, int a, int b)
        {
            housing = new Rectangle(new Pair(0, 0), new Pair(n, m));
            point = new Pair(x, y);
            ratio = new Pair(a, b);
        }

        public String solve()
        {
            Pair rectDims = housing.getLargestFit(ratio.simplify());
            Rectangle result = housing.getClosestRectangle(point, rectDims);
            return result.ToString();
        }

        public override String ToString()
        {
            return housing.ToString() + " " + point.ToString() + " " + ratio.ToString();
        }

        static void Main(string[] args)
        {
            String line = Console.ReadLine();
            String[] temp = line.Split(' ');
            int[] vals = new int[temp.Length];
            for (int i = 0; i < vals.Length; ++i)
            {
                vals[i] = Convert.ToInt32(temp[i]);
            }
            Prob303B prob = new Prob303B(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5]);
            Console.WriteLine(prob.solve());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class Prob303B
    {
        //Your task is to find a maximum sub-rectangle on the grid (x1, y1, x2, y2) so that it contains the given point (x, y),
        //and its length-width ratio is exactly (a, b). In other words the following conditions must hold:
        //0 ≤ x1 ≤ x ≤ x2 ≤ n, 0 ≤ y1 ≤ y ≤ y2 ≤ m, (x2-x1)/(y2-y1)=a/b.

        //The sides of this sub-rectangle should be parallel to the axes. And values x1, y1, x2, y2 should be integers.

        //If there are multiple solutions, find the rectangle which is closest to (x, y). Here "closest" means the Euclid
        //distance between (x, y) and the center of the rectangle is as small as possible. If there are still multiple
        //solutions, find the lexicographically minimum one. Here "lexicographically minimum" means that we should consider
        //the sub-rectangle as sequence of integers (x1, y1, x2, y2), so we can choose the lexicographically minimum one.
        class Pair
        {
            int x;
            int y;

            public Pair()
            {
                x = 0;
                y = 0;
            }

            public Pair(int xx, int yy)
            {
                x = xx;
                y = yy;
            }

            public int X
            {
                get { return x; }
                set { x = value; }
            }

            public int Y
            {
                get { return y; }
                set { y = value; }
            }

            public Pair makeBigger(int n)
            {
                return new Pair(x * n, y * n);
            }

            public Pair shift(Pair shiftBy)
            {
                return new Pair(x + shiftBy.X, y + shiftBy.Y);
            }

            public Pair simplify()
            {
                int a = x;
                int b = y;
                int rem;

                while (b != 0)
                {
                    rem = a % b;
                    a = b;
                    b = rem;
                }
                return new Pair(x / a, y / a);
            }

            public override String ToString()
            {
                return x + " " + y;
            }
        }

        class Rectangle
        {
            Pair bottomLeft;
            Pair upperRight;
            int width;
            int height;

            public Rectangle()
            {
                bottomLeft = new Pair();
                upperRight = new Pair();
                width = 0;
                height = 0;
            }

            public Rectangle(Pair bl, Pair ur)
            {
                bottomLeft = bl;
                upperRight = ur;
                width = upperRight.X - bottomLeft.X;
                height = upperRight.Y - bottomLeft.Y;
            }

            public Pair getLargestFit(Pair ratio)
            {
                Pair p = new Pair(ratio.X, ratio.Y);
                int max = Math.Min(width / p.X, height / p.Y);
                return p.makeBigger(max);
            }

            public Rectangle getClosestRectangle(Pair point, Pair dims)
            {
                Pair bottomLeftCorner = new Pair();

                bottomLeftCorner.X = point.X - (dims.X / 2) - (dims.X & 1);
                if (bottomLeftCorner.X < 0)
                {
                    bottomLeftCorner.X = 0;
                }
                else if (bottomLeftCorner.X + dims.X > width)
                {
                    bottomLeftCorner.X = width - dims.X;
                }

                bottomLeftCorner.Y = point.Y - (dims.Y / 2) - (dims.Y & 1);
                if (bottomLeftCorner.Y < 0)
                {
                    bottomLeftCorner.Y = 0;
                }
                else if (bottomLeftCorner.Y + dims.Y > height)
                {
                    bottomLeftCorner.Y = width - dims.Y;
                }

                return new Rectangle(bottomLeftCorner, bottomLeftCorner.shift(dims));
            }

            public override String ToString()
            {
                return bottomLeft.ToString() + " " + upperRight.ToString();
            }
        }

        Rectangle housing;
        Pair point;
        Pair ratio;

        public Prob303B(int n, int m, int x, int y, int a, int b)
        {
            housing = new Rectangle(new Pair(0, 0), new Pair(n, m));
            point = new Pair(x, y);
            ratio = new Pair(a, b);
        }

        public String solve()
        {
            Pair rectDims = housing.getLargestFit(ratio.simplify());
            Rectangle result = housing.getClosestRectangle(point, rectDims);
            return result.ToString();
        }

        public override String ToString()
        {
            return housing.ToString() + " " + point.ToString() + " " + ratio.ToString();
        }

        static void Main(string[] args)
        {
            String line = Console.ReadLine();
            String[] temp = line.Split(' ');
            int[] vals = new int[temp.Length];
            for (int i = 0; i < vals.Length; ++i)
            {
                vals[i] = Convert.ToInt32(temp[i]);
            }
            Prob303B prob = new Prob303B(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5]);
            Console.WriteLine(prob.solve());
        }
    }
}

using System;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Globalization;
using System.Collections.Generic;
using System.Threading;
using kp.Algo;

namespace CodeForces
{
	internal class Solution
	{
		const int StackSize = 20 * 1024 * 1024;

		private void Solve()
		{
			long n = NextLong(), m = NextLong(), x = NextLong(), y = NextLong(), a = NextLong(), b = NextLong();
			long g = NumTheoryUtils.Gcd( a, b );
			a /= g;
			b /= g;
			long k = Math.Min( n / a, m / b );
			long xl = k * a, yl = k * b;
			long x1 = xl % 2 == 0 ? x - xl / 2 : x - xl / 2 - 1;
			long y1 = yl % 2 == 0 ? y - yl / 2 : y - yl / 2 - 1;
			if ( x1 < 0 ) x1 = 0;
			if ( y1 < 0 ) y1 = 0;
			if ( x1 + xl > n ) x1 -= n - ( x1 + xl );
			if ( y1 + yl > m ) y1 -= m - ( y1 + yl );
			Out.WriteLine( string.Format( "{0} {1} {2} {3}", x1, y1, x1 + xl, y1 + yl ) );
		}

		#region Local wireup

		public int NextInt()
		{
			return _in.NextInt();
		}

		public long NextLong()
		{
			return _in.NextLong();
		}

		public string NextLine()
		{
			return _in.NextLine();
		}

		public double NextDouble()
		{
			return _in.NextDouble();
		}

		readonly Scanner _in = new Scanner();
		static readonly TextWriter Out = Console.Out;

		void Start()
		{
#if !ONLINE_JUDGE
			var timer = new Stopwatch();
			timer.Start();
#endif
			var t = new Thread( Solve, StackSize );
			t.Start();
			t.Join();
#if !ONLINE_JUDGE
			timer.Stop();
			Console.WriteLine( string.Format( CultureInfo.InvariantCulture, "Done in {0} seconds.\nPress <Enter> to exit.", timer.ElapsedMilliseconds / 1000.0 ) );
			Console.ReadLine();
#endif
		}

		static void Main()
		{
			new Solution().Start();
		}

		class Scanner : IDisposable
		{
			#region Fields

			readonly TextReader _reader;
			readonly int _bufferSize;
			readonly bool _closeReader;
			readonly char[] _buffer;
			int _length, _pos;

			#endregion

			#region .ctors

			public Scanner( TextReader reader, int bufferSize, bool closeReader )
			{
				_reader = reader;
				_bufferSize = bufferSize;
				_closeReader = closeReader;
				_buffer = new char[_bufferSize];
				FillBuffer( false );
			}

			public Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }

			public Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }

#if ONLINE_JUDGE
			public Scanner() : this( Console.In, false ) { }
#else
			public Scanner() : this( "input.txt" ) { }
#endif

			#endregion

			#region IDisposable Members

			public void Dispose()
			{
				if ( _closeReader )
				{
					_reader.Close();
				}
			}

			#endregion

			#region Properties

			public bool Eof
			{
				get
				{
					if ( _pos < _length ) return false;
					FillBuffer( false );
					return _pos >= _length;
				}
			}

			#endregion

			#region Methods

			private char NextChar()
			{
				if ( _pos < _length ) return _buffer[_pos++];
				FillBuffer( true );
				return _buffer[_pos++];
			}

			private char PeekNextChar()
			{
				if ( _pos < _length ) return _buffer[_pos];
				FillBuffer( true );
				return _buffer[_pos];
			}

			private void FillBuffer( bool throwOnEof )
			{
				_length = _reader.Read( _buffer, 0, _bufferSize );
				if ( throwOnEof && Eof )
				{
					throw new IOException( "Can't read beyond the end of file" );
				}
				_pos = 0;
			}

			public int NextInt()
			{
				var neg = false;
				int res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public long NextLong()
			{
				var neg = false;
				long res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public string NextLine()
			{
				SkipUntilNextLine();
				if ( Eof ) return "";
				var builder = new StringBuilder();
				while ( !Eof && !IsEndOfLine( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return builder.ToString();
			}

			public double NextDouble()
			{
				SkipWhitespaces();
				var builder = new StringBuilder();
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return double.Parse( builder.ToString(), CultureInfo.InvariantCulture );
			}

			private void SkipWhitespaces()
			{
				while ( !Eof && IsWhitespace( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private void SkipUntilNextLine()
			{
				while ( !Eof && IsEndOfLine( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private static bool IsWhitespace( char c )
			{
				return c == ' ' || c == '\t' || c == '\n' || c == '\r';
			}

			private static bool IsEndOfLine( char c )
			{
				return c == '\n' || c == '\r';
			}

			#endregion
		}

		#endregion
	}
}

namespace kp.Algo { }

namespace kp.Algo
{
	static class NumTheoryUtils
	{
		public static long Gcd( long a, long b )
		{
			if ( a < 0 ) a = -a;
			if ( b < 0 ) b = -b;
			return b == 0 ? a : Gcd( b, a % b );
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace D
{
    class Program
    {
        public static int gcd(int a, int b)
        {
            if (a < b)
            {
                return gcd(b, a);
            }
            else
            {
                if (b == 0)
                {
                    return a;
                }
                else
                {
                    return gcd(b, a % b);
                }
            }
        }
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 2; testN++)
            {
#endif
                //SetCulture();
                var n = NextInt();
                var m = NextInt();
                var x = NextInt();
                var y = NextInt();
                var a = NextInt();
                var b = NextInt();

                var g = gcd(a, b);
                a = a / g;
                b = b / g;
                var ma = n / a;
                var mb = m / b;
                var k = Math.Min(ma, mb);
                var mx = k * a;
                var my = k * b;

                var x1 = x - ((mx + 1) / 2);
                var y1 = y - ((my + 1) / 2);
                var x2 = x + (mx / 2);
                var y2 = y + (my / 2);

                Console.WriteLine("{0} {1} {2} {3}", x1, y1, x2, y2);
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

#define Online
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            int n, m, x, y, a, b;
            string[] input = ReadArray();
            n = int.Parse(input[0]);
            m = int.Parse(input[1]);
            x = int.Parse(input[2]);
            y = int.Parse(input[3]);
            a = int.Parse(input[4]);
            b = int.Parse(input[5]);

            int gcd = MyMath.GCD(a, b);
            a /= gcd;
            b /= gcd;

            int left = 1;
            int right = m;

            int mid;
            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (mid * a >= m || mid * b >= n)
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }
            if (!(left * a <= m && left * b <= n))
                left--;

            int w, h;
            w = left * a;
            h = left * b;
            int x1, y1, x2, y2;

            if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) >= 0)
            {
                if (x + w / 2 > m)
                {
                    x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);
                    x1 -= (x1 + w - m);
                    x2 = x1 + w;
                }
                else
                {
                    x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);
                    x2 = x1 + w;
                }
            }
            else
            {
                x1 = 0;
                x2 = w;
            }
            if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) >= 0)
            {
                if (y + h / 2 > n)
                {
                    y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);
                    y1 -= (y1 + h - n);
                    y2 = y1 + h;
                }
                else
                {
                    y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);
                    y2 = y1 + h;
                }
            }
            else
            {
                y1 = 0;
                y2 = h;
            }
            Console.WriteLine(x1 + " " + y1 + " " + x2 + " " + y2);
#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
    }

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    public class SegmentTree
    {
        int[] v_min;
        int[] v_max;
        int[] mas;
        public void BuildTree(int[] a)
        {
            int n = a.Length - 1;
            int z = 0;
            while (n >= 2)
            {
                z++;
                n >>= 1;
            }
            n = 1 << (z + 1);
            v_min = new int[n << 1];
            v_max = new int[n << 1];
            mas = new int[n << 1];
            for (int i = n; i < n + a.Length; i++)
                v_min[i] = a[i - n];
            for (int i = n + a.Length; i < v_min.Length; i++)
                v_min[i] = int.MaxValue;
            for (int i = n - 1; i > 0; i--)
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);

            for (int i = n; i < n + a.Length; i++)
                v_max[i] = a[i - n];
            for (int i = n + a.Length; i < v_max.Length; i++)
                v_max[i] = int.MinValue;
            for (int i = n - 1; i > 0; i--)
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);

        }
        //nil
        public int RMQ_MIN(int l, int r)
        {
            int ans = int.MaxValue;
            l += v_min.Length >> 1;
            r += v_min.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Min(ans, v_min[l]);
                if (!((r & 1) == 0))
                    ans = Math.Min(ans, v_min[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public int RMQ_MAX(int l, int r)
        {
            int ans = int.MinValue;
            l += v_max.Length >> 1;
            r += v_max.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Max(ans, v_max[l]);
                if (!((r & 1) == 0))
                    ans = Math.Max(ans, v_max[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public void Put(int l, int r, int op)
        {
            l += mas.Length >> 1;
            r += mas.Length >> 1;
            while (l <= r)
            {
                if (l % 2 != 0)
                    mas[l] = op;
                if (r % 2 == 0)
                    mas[r] = op;
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
        }

        public int Get(int x)
        {
            x += mas.Length >> 1;
            int ans = int.MinValue;
            while (x > 0)
            {
                ans = Math.Max(mas[x], ans);
                x >>= 1;
            }
            return ans;
        }

        public void Update(int i, int x)
        {
            i += v_min.Length >> 1;
            v_min[i] = x;
            v_max[i] = x;
            i >>= 1;
            while (i > 0)
            {
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);
                i >>= 1;
            }
        }
    }
    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }
    class Graph
    {
        public List<List<int>> g = new List<List<int>>();
        public List<Edge> e = new List<Edge>();
        public Stack<int> s;
        public List<bool> u;
        public List<int> d; //длина
        public List<int> p; //путь
        public Queue<int> q;
        public int n;
        public int start;
        public int finish;
        public Graph(int n)
        {
            for (int i = 0; i <= n; i++)
                g.Add(new List<int>());
            p = new List<int>();
            d = new List<int>();
            for (int i = 0; i <= n; i++)
                p.Add(-1);
            for (int i = 0; i <= n; i++)
                d.Add(-1);
            u = new List<bool>();
            for (int i = 0; i <= n; i++)
                u.Add(true);
            this.n = n;
        }

        public bool dfs1(int v)
        {
            u[v] = false;
            for (int i = 0; i < g[v].Count; i++)
            {
                if (u[g[v][i]])
                {
                    p[g[v][i]] = v;
                    if (dfs1(g[v][i])) return true;
                }
                else
                {
                    if (p[v] != g[v][i])
                    {
                        start = v;
                        finish = g[v][i];
                        return true;
                    }
                }
            }
            return false;
        }

        public void dfs2(int v)
        {
            s = new Stack<int>();
            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (d[g[cur][i]] == -1)
                    {
                        s.Push(g[cur][i]);
                        d[g[cur][i]] = d[cur] + 1;
                        all = false;
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void DFS(int v)
        {
            s = new Stack<int>();

            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                u[cur] = false;
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (u[g[cur][i]])
                    {
                        all = false;
                        p[g[cur][i]] = cur;
                        s.Push(g[cur][i]);
                    }
                    else
                    {
                        if (p[cur] != g[cur][i])
                        {
                            start = cur;
                            finish = g[cur][i];
                            return;
                        }
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void BFS(params int[] v)
        {
            q = new Queue<int>();
            u = new List<bool>();
            d = new List<int>();
            p = new List<int>();

            for (int i = 0; i <= n; i++)
            {
                u.Add(true);
                d.Add(0);
                p.Add(0);
            }

            q.Enqueue(v[0]);
            u[v[0]] = false;
            int cur;

            while (q.Count != 0)
            {
                cur = q.Dequeue();
                for (int i = 0; i < g[cur].Count; i++)
                    if (u[g[cur][i]])
                    {
                        q.Enqueue(g[cur][i]);
                        u[g[cur][i]] = false;
                        p[g[cur][i]] = cur;
                        d[g[cur][i]] = d[cur] + 1;
                    }
            }

            int from = v[1];
            string path = from + "";
            while (p[from] != 0)
            {
                path = p[from] + " " + path;
                from = p[from];
            }
            Console.WriteLine(d[v[1]] + " : " + path);
        }

        public void FordBellman(params int[] v)
        {
            d = new List<int>();
            p = new List<int>();
            for (int i = 0; i <= n; i++)
            {
                d.Add(int.MaxValue);
                p.Add(0);
            }
            d[v[0]] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < e.Count; j++)
                {
                    if (d[e[j].a] != int.MaxValue)
                    {
                        if (d[e[j].a] + e[j].w < d[e[j].b])
                        {
                            d[e[j].b] = d[e[j].a] + e[j].w;
                            p[e[j].b] = e[j].a;
                        }
                    }
                }
            }

            int from = v[1];

            if (d[from] == int.MaxValue)
            {
                Console.WriteLine("Can't find the minimal path");
                return;
            }

            string ans = from + "";
            while (p[from] != 0)
            {
                ans = p[from] + " " + ans;
                from = p[from];
            }

            Console.WriteLine(d[v[1]] + " : " + ans);
        }
    }
    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}

#define Online
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            long n, m, x, y, a, b;
            string[] input = ReadArray();
            n = long.Parse(input[0]);
            m = long.Parse(input[1]);
            x = long.Parse(input[2]);
            y = long.Parse(input[3]);
            a = long.Parse(input[4]);
            b = long.Parse(input[5]);

            long gcd = MyMath.GCD(a, b);
            a /= gcd;
            b /= gcd;

            long left = 1;
            long right = m;

            long mid;
            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (mid * a >= m || mid * b >= n)
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }
            if (!(left * a <= m && left * b <= n))
                left--;

            long w, h;
            w = left * a;
            h = left * b;
            long x1, y1, x2, y2;

            if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) >= 0)
            {
                if (x + w / 2 > m)
                {
                    x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);
                    x1 -= (x1 + w - m);
                    x2 = x1 + w;
                }
                else
                {
                    x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);
                    x2 = x1 + w;
                }
            }
            else
            {
                x1 = 0;
                x2 = w;
            }
            if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) >= 0)
            {
                if (y + h / 2 > n)
                {
                    y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);
                    y1 -= (y1 + h - n);
                    y2 = y1 + h;
                }
                else
                {
                    y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);
                    y2 = y1 + h;
                }
            }
            else
            {
                y1 = 0;
                y2 = h;
            }
            Console.WriteLine(x1 + " " + y1 + " " + x2 + " " + y2);
#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
    }

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    public class SegmentTree
    {
        int[] v_min;
        int[] v_max;
        int[] mas;
        public void BuildTree(int[] a)
        {
            int n = a.Length - 1;
            int z = 0;
            while (n >= 2)
            {
                z++;
                n >>= 1;
            }
            n = 1 << (z + 1);
            v_min = new int[n << 1];
            v_max = new int[n << 1];
            mas = new int[n << 1];
            for (int i = n; i < n + a.Length; i++)
                v_min[i] = a[i - n];
            for (int i = n + a.Length; i < v_min.Length; i++)
                v_min[i] = int.MaxValue;
            for (int i = n - 1; i > 0; i--)
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);

            for (int i = n; i < n + a.Length; i++)
                v_max[i] = a[i - n];
            for (int i = n + a.Length; i < v_max.Length; i++)
                v_max[i] = int.MinValue;
            for (int i = n - 1; i > 0; i--)
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);

        }
        //nil
        public int RMQ_MIN(int l, int r)
        {
            int ans = int.MaxValue;
            l += v_min.Length >> 1;
            r += v_min.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Min(ans, v_min[l]);
                if (!((r & 1) == 0))
                    ans = Math.Min(ans, v_min[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public int RMQ_MAX(int l, int r)
        {
            int ans = int.MinValue;
            l += v_max.Length >> 1;
            r += v_max.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Max(ans, v_max[l]);
                if (!((r & 1) == 0))
                    ans = Math.Max(ans, v_max[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public void Put(int l, int r, int op)
        {
            l += mas.Length >> 1;
            r += mas.Length >> 1;
            while (l <= r)
            {
                if (l % 2 != 0)
                    mas[l] = op;
                if (r % 2 == 0)
                    mas[r] = op;
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
        }

        public int Get(int x)
        {
            x += mas.Length >> 1;
            int ans = int.MinValue;
            while (x > 0)
            {
                ans = Math.Max(mas[x], ans);
                x >>= 1;
            }
            return ans;
        }

        public void Update(int i, int x)
        {
            i += v_min.Length >> 1;
            v_min[i] = x;
            v_max[i] = x;
            i >>= 1;
            while (i > 0)
            {
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);
                i >>= 1;
            }
        }
    }
    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }
    class Graph
    {
        public List<List<int>> g = new List<List<int>>();
        public List<Edge> e = new List<Edge>();
        public Stack<int> s;
        public List<bool> u;
        public List<int> d; //длина
        public List<int> p; //путь
        public Queue<int> q;
        public int n;
        public int start;
        public int finish;
        public Graph(int n)
        {
            for (int i = 0; i <= n; i++)
                g.Add(new List<int>());
            p = new List<int>();
            d = new List<int>();
            for (int i = 0; i <= n; i++)
                p.Add(-1);
            for (int i = 0; i <= n; i++)
                d.Add(-1);
            u = new List<bool>();
            for (int i = 0; i <= n; i++)
                u.Add(true);
            this.n = n;
        }

        public bool dfs1(int v)
        {
            u[v] = false;
            for (int i = 0; i < g[v].Count; i++)
            {
                if (u[g[v][i]])
                {
                    p[g[v][i]] = v;
                    if (dfs1(g[v][i])) return true;
                }
                else
                {
                    if (p[v] != g[v][i])
                    {
                        start = v;
                        finish = g[v][i];
                        return true;
                    }
                }
            }
            return false;
        }

        public void dfs2(int v)
        {
            s = new Stack<int>();
            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (d[g[cur][i]] == -1)
                    {
                        s.Push(g[cur][i]);
                        d[g[cur][i]] = d[cur] + 1;
                        all = false;
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void DFS(int v)
        {
            s = new Stack<int>();

            s.Push(v);
            int cur;
            bool all;
            while (s.Count != 0)
            {
                cur = s.Peek();
                u[cur] = false;
                all = true;
                for (int i = 0; i < g[cur].Count; i++)
                {
                    if (u[g[cur][i]])
                    {
                        all = false;
                        p[g[cur][i]] = cur;
                        s.Push(g[cur][i]);
                    }
                    else
                    {
                        if (p[cur] != g[cur][i])
                        {
                            start = cur;
                            finish = g[cur][i];
                            return;
                        }
                    }
                }
                if (all)
                    s.Pop();
            }
        }

        public void BFS(params int[] v)
        {
            q = new Queue<int>();
            u = new List<bool>();
            d = new List<int>();
            p = new List<int>();

            for (int i = 0; i <= n; i++)
            {
                u.Add(true);
                d.Add(0);
                p.Add(0);
            }

            q.Enqueue(v[0]);
            u[v[0]] = false;
            int cur;

            while (q.Count != 0)
            {
                cur = q.Dequeue();
                for (int i = 0; i < g[cur].Count; i++)
                    if (u[g[cur][i]])
                    {
                        q.Enqueue(g[cur][i]);
                        u[g[cur][i]] = false;
                        p[g[cur][i]] = cur;
                        d[g[cur][i]] = d[cur] + 1;
                    }
            }

            int from = v[1];
            string path = from + "";
            while (p[from] != 0)
            {
                path = p[from] + " " + path;
                from = p[from];
            }
            Console.WriteLine(d[v[1]] + " : " + path);
        }

        public void FordBellman(params int[] v)
        {
            d = new List<int>();
            p = new List<int>();
            for (int i = 0; i <= n; i++)
            {
                d.Add(int.MaxValue);
                p.Add(0);
            }
            d[v[0]] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < e.Count; j++)
                {
                    if (d[e[j].a] != int.MaxValue)
                    {
                        if (d[e[j].a] + e[j].w < d[e[j].b])
                        {
                            d[e[j].b] = d[e[j].a] + e[j].w;
                            p[e[j].b] = e[j].a;
                        }
                    }
                }
            }

            int from = v[1];

            if (d[from] == int.MaxValue)
            {
                Console.WriteLine("Can't find the minimal path");
                return;
            }

            string ans = from + "";
            while (p[from] != 0)
            {
                ans = p[from] + " " + ans;
                from = p[from];
            }

            Console.WriteLine(d[v[1]] + " : " + ans);
        }
    }
    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}