{$W no-implicit-abstract}

program fjf636e;

type
  a = object
    f: Integer
  end;

  b = object (a)
    g: Integer
  end;

  c = abstract object
    f: Integer
  end;

  d = object (c)
    g: Integer
  end;

  e = object
    procedure Foo; abstract;
  end;

var
  v: a;
  w: b;
  x: d;

begin
  if TypeOf (v) <> TypeOf (a) then
    WriteLn ('failed 1 ', PtrInt (Typeof (v)), ' ', PtrInt (TypeOf (a)))
  else if SizeOf (v) <> SizeOf (a) then
    WriteLn ('failed 2 ', SizeOf (v), ' ', SizeOf (a))
  else with TypeOf (v)^ do if Size <> SizeOf (a) then
    WriteLn ('failed 3 ', Size, ' ', SizeOf (a))
  else if NegatedSize <> -SizeOf (v) then
    WriteLn ('failed 4 ', NegatedSize, ' ', -SizeOf (v))
  else if Parent <> nil then
    WriteLn ('failed 5 ', PtrInt (Parent), ' ', 0)
  else if Name^ <> 'A' then
    WriteLn ('failed 6 ', Name^, ' A')
  else if TypeOf (w) <> TypeOf (b) then
    WriteLn ('failed 7 ', PtrInt (Typeof (w)), ' ', PtrInt (TypeOf (b)))
  else if SizeOf (w) <> SizeOf (b) then
    WriteLn ('failed 8 ', SizeOf (w), ' ', SizeOf (b))
  else with TypeOf (b)^ do if Size <> SizeOf (w) then
    WriteLn ('failed 9 ', Size, ' ', SizeOf (w))
  else if NegatedSize <> -SizeOf (b) then
    WriteLn ('failed 10 ', NegatedSize, ' ', -SizeOf (b))
  else if Parent <> TypeOf (v) then
    WriteLn ('failed 11 ', PtrInt (Parent), ' ', PtrInt (TypeOf (v)))
  else if Name^ <> 'B' then
    WriteLn ('failed 12 ', Name^, ' B')
  else if Parent^.Name^ <> 'A' then
    WriteLn ('failed 13 ', Parent^.Name^, ' A')
  else if Parent^.Parent <> nil then
    WriteLn ('failed 14 ', PtrInt (Parent^.Parent), 0)
  else if TypeOf (x) <> TypeOf (d) then
    WriteLn ('failed 15 ', PtrInt (Typeof (x)), ' ', PtrInt (TypeOf (d)))
  else if SizeOf (x) <> SizeOf (d) then
    WriteLn ('failed 16 ', SizeOf (x), ' ', SizeOf (d))
  else with TypeOf (d)^ do if Size <> SizeOf (x) then
    WriteLn ('failed 17 ', Size, ' ', SizeOf (x))
  else if NegatedSize <> -SizeOf (x) then
    WriteLn ('failed 18 ', NegatedSize, ' ', -SizeOf (x))
  else if Parent <> TypeOf (c) then
    WriteLn ('failed 19 ', PtrInt (Parent), ' ', PtrInt (TypeOf (c)))
  else if Name^ <> 'D' then
    WriteLn ('failed 20 ', Name^, ' D')
  else with TypeOf (c)^ do if Size <> 0 then
    WriteLn ('failed 21 ', Size, ' ', 0)
  else if NegatedSize <> 0 then
    WriteLn ('failed 22 ', NegatedSize, ' ', 0)
  else if Parent <> nil then
    WriteLn ('failed 23 ', PtrInt (Parent), ' ', 0)
  else if Name^ <> 'C' then
    WriteLn ('failed 24 ', Name^, ' C')
  else with TypeOf (e)^ do if Size <> 0 then
    WriteLn ('failed 25 ', Size, ' ', 0)
  else if NegatedSize <> 0 then
    WriteLn ('failed 26 ', NegatedSize, ' ', 0)
  else if Parent <> nil then
    WriteLn ('failed 27 ', PtrInt (Parent), ' ', 0)
  else if Name^ <> 'E' then
    WriteLn ('failed 28 ', Name^, ' E')
  else
    WriteLn ('OK')
end.
